Dump all variables in PHP
问题 There's a memory leak in my script and I couldn't find it after 2 days. I found the loop that is causing the memory leak; each iteration of the loop increases the memory usage. I moved the loop into a function to isolate the variables. At the end of the function, I unsetted every variable created by the function so that get_defined_vars() returns an empty array. Here's what I mean: function the_loop(){ $var="value"; ... // processing, including using a library unset($var); print_r(get_defined