Is there a way to view the variables set on each stack stack in backtrace? I can get pretty close with a combination of debug_backtrace(true) to get objects, get_object_vars for each object to get $ this vars, the args key in each backtrace frame and get_defined_vars to get global values, but any temporary variables set inside the function, I canβt find a way to get it.
Here is an example of a situation:
function method1($foo) { $temp = method2($foo + 1); foreach ($temp as $t) { method2($t); } } function method2($bar) { $temp2 = $bar->value + $_GET['val']; debug(); } function debug() {
I can get $foo and $bar using the args key in backtrace, $bar object variables via get_object_vars and global variables via get_defined_vars . I want to get the value of $temp2 and $temp .
scope php backtrace
Ian wetherbee
source share