Exercise: types
Write a PHP script based on the previous example
that prints the value of $foo at each step
Modify the program so that it prints each line of
code before dumping the variable value.
Generalise as a function executeWithTrace($prog, $var)
-
$prog is a text string, one program statement per line
-
$var is the name of the variable to be traced
- scan program string, execute each line, dump variable
|