Where are all my PHP variables hiding?

16885879.jpg

Sometimes it's difficult to remember what variables you have available to you at any given time, especially if your script is split into functions, or in my case you're working with Drupal, where there's a whole slew of variables available at your disposal, if only you know what they were called. Lucky for curious folks like us, there's a couple native PHP functions that will clear things up:

//Returns an array of all variables and their values. Sweet!
get_defined_vars();

//Prints out the contents of whatever variable you pass to it.
var_dump();


Syndicate content
Implied By Design Logo