Show all available PHP variables - get_defined_vars
If you want to find out what variables are defined in the current scope during PHP execution, you can use the get_defined_vars() function. This is particularly useful when working in Drupal's .tpl.php files where you want to see what variables are getting passed into the template file.
var_dump(get_defined_vars());
I somehow have a mental block with this function name and usually end up searching for it with terms like "show available variables in PHP", which isn't very helpful, except from now on, when I search for that on Google, I'll get this post to remind me ;-)
See also get_defined_vars(), get_defined_constants() and get_defined_functions().




![Richard Strauss: Der Rosenkavalier [Highlights] Richard Strauss: Der Rosenkavalier [Highlights] cover image](http://ecx.images-amazon.com/images/I/41XRK7SFF2L._SL160_.jpg)

I have the exact same mental
I have the exact same mental block - this is the second time I've googled for 15 minutes to find this post. Thanks!
lol
when I searched for "drupal +getting all available variables" this page was second :p
Thanks
I knew there would be a function for this; nice simple post here proved it to me!
Thank you.
bWfxuiLDkGyUOqbtY
you can better, pink vodka sauce recipe, http://crack3.infinites.net/vodka/pink-vodka-sauce-recipe.html pink vodka sauce recipe, 418, alcoholic drink made with basil and lemonade and vodka, http://crack3.infinites.net/vodka/alcoholic-drink-made-with-basil-and-le... alcoholic drink made with basil and lemonade and vodka, >:-]], vodka injected watermelon, http://crack3.infinites.net/vodka/vodka-injected-watermelon.html vodka injected watermelon, 848724, vodka peach schnapps lemonade, http://crack3.infinites.net/vodka/vodka-peach-schnapps-lemonade.html vodka peach schnapps lemonade, %]],
Thanks
This was exactly what I was looking for. I searched for "variables available at time of execution php" and this page was the first to come up.
Funny that I was actually looking for this because I am debugging a drupal site which had nothing to do with my search string.
Post new comment