[PHP] Show/print all variables in use.

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

0 Kommentare

Hinterlasse einen Kommentar

An der Diskussion beteiligen?
Hinterlasse uns deinen Kommentar!

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert