[PHP] Show/print all variables in use.
Dieser Beitrag ist auch verfügbar in: German
Hi,
today I asked myself how the variables look like at the end of my script. I mean I use variables, include scripts, make database requests… and I always try to care to unset the variables again when I don’t need them anymore. But to I get all… or does my script use more and more memory? And how can I control it?
PHP have also for this question a solution. get_defined_vars() shows all variables which are currently in use.
print_r(get_defined_vars());
Call this function at the end (or somewhere between) and you know exactly which variables are in use and where you have to clean up.
Very nice :-)
Best regards
Gordon
Leave a Reply
Want to join the discussion?Feel free to contribute!