Getting the available variables in Drupal
It’s simple but it’s a complete headache if you’ve had this problem and found this post (or a similar one) trying to do what this function does. What I mean when I say “Get available variables” or “Get the available variables in Drupal” or “Find the available variables in PHP” or any number of combinations you’re still havin the same problems.
Get the available (defined) variables in Drupal
You want the variables available to you in a PHP script. This is tailored for Drupal only because it’s the reason I came across it FOR a PROBLEM I was having in Drupal. It’s what I use this function the most for but I can see this having seriously dynamic capabilities if used correctly (I’d elaborate, but it’s too genius… it seems. I want to play around with it first. Think Russian doll situation (while maintaining the same size, but not relationally) with a level of granularity where weight wasn’t a factor, it could be an axis position on axis’ with one object allowing large amounts of array data and non-scalar information between-themselves to be displayed at a dashboard-like interface. Maybe I’m making it a Drupal module, maybe I’m not.)
The code is!
// Get the available aka "defined" vars available to Drupal print_r(get_defined_vars());
Pretty simple like I said but if you’ve ever been there you’ll thank me every day. Every. Single. Day.
WAM BAM THANK YOU MA’M.
Bryan
