[PHP] How to print variable name and contents

2005-06-15 Thread nntp.charter.net
I want to write a trace procedure and call it with variable names, and I am 
having trouble with the syntax.  My goal is to have a procedure that will 
echo lines such as:

Trace: $myvar="the contents of $myvar

My attempt that didn't work is to write a function:

function my_trace($m){
   echo ("\nTRACE: $m = ");
   eval("\$t=\"$m\";");
   echo($t."\n");
 }

and call it with statements like:

my_trace("\$my_var");
my_trace("\$_ENV[\"COMPUTERNAME\"]");

What am I doing wrong, and how should this be done?  Also, should I post to 
a different group?

Thanks,
Gil Grodsky
[EMAIL PROTECTED]

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: How to print variable name and contents

2005-06-21 Thread nntp.charter.net
Bob and Ed and others,

Thanks for all the responses.  They really helped.

-- Gil 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php