Variable Dump - echo all variables in a script

When de-bugging, it is good to know what variables are available at any one part of the script.

So I often echo out the variables, sometimes having them showing as html comments on the source of the page so as to not to disturb the page content.


print '<pre>' . htmlspecialchars(print_r(get_defined_vars(), true)) . '</pre>';
print '<pre>' . htmlspecialchars(print_r($_SERVER, true)) . '</pre>';

(copying some old posts from an forum of mine that I wish to keep)

Subscribe to be notified of new posts

Enter your email address:

Delivered by FeedBurner