PHP Function to Output Variable Information to Browser or File
Posted on 2007-03-19
I want to write a PHP function that outputs variable information to the browser or a string.
The function must handle single variables and arrays. Currently, I use the following:
echo "\$variable is:<br>";
I want a function that you can pass the variable to it, and it will do the same.
For example, if $a=23, $b="A string", $c=array(2,3,4), then the function must be able to handle all of these.
if $return is TRUE, the output is returned as a string. Otherwise, it must output to the browser. The string can then be outputted to a debug file if needed.