Re: Print a variable's name
| From: | Ahbaid Gaffoor | Date: | Wed, 05 May 2004 15:13:16 +0000 |
| Subject: | Re: Print a variable's name | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-185433@lists.php.net to get a copy of this message | ||
Thanks Ryan,
but what I want is to be able to pass any variable to a procedure and have the variable name and value printed by the procedure.
Can this be done?
I'm trying to extend my library of debugging functions/procedures by having a procedure which can be used to "inspect" a variable whenever I call it.
Thanks
Ahbaid
Ryan A wrote:
Just escape it... eg: $ryan = "something"; echo "\$ryan =".$ryan; that would print: $ryan = something HTH. Cheers, -Ryan On 5/5/2004 5:02:25 PM, ahbaid@att.net wrote:I'd like to print a variable's name in a procedure along with it'svalue....Is there a way to do this? for example: ---------------------------------------------------------------------------function showvar($somevar) { echo "Now showing: ". <....... code to show var name .....> ."\n"; echo "Value: ".$somevar; } $s1 = "Hello World"; showvar($s1); ---------------------------------------------------------------------------would produce: ---------------------------------------------------------------------------Now showing: $s1 Value: Hello World ---------------------------------------------------------------------------many thanks in advance... Ahbaid -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php