That's the way I ended up going
pass the name and value along :)
Not what I was hoping for, but it gets the job done, and it's only for
debugging pruposes
thanks
Ahbaid.
Michal Migurski wrote:
but what I want is to be able to pass any variable to a procedure and
have the variable name and
> 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.
Because PHP passes arguments by value, you will be out of luck in most
cases -- by the time your debugging function sees the argument, it's no
longer tied to the cal
ame."\n";
echo "Variable Value: ".$var."\n";
}
showvar($test);
This is the only thing that works for me.I know it is messy
-Original Message-
From: Michael Sims [mailto:[EMAIL PROTECTED]
Sent: 05 May 2004 4:23 PM
To: [EMAIL PROTE
Dave Avent wrote:
> function showvar($var) {
>
> foreach($GLOBALS as $key => $value) {
> if($value == $var) {
> $varname = $key;
> }
> }
The problem with the above is that it assumes that th
EMAIL PROTECTED]
Sent: 05 May 2004 4:23 PM
To: [EMAIL PROTECTED]
Subject: RE: [PHP] Print a variable's name
Ahbaid Gaffoor wrote:
> 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 pro
Ahbaid Gaffoor wrote:
> 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 ca
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 whenev
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, [EMAIL PROTECTED] wrote:
> I'd like to print a variable's name in a procedure along with it's
value
>
> Is there a way to do this?
>
>
> fo
I'd like to print a variable's name in a procedure along with it's value
Is there a way to do this?
for example:
---
function showvar($somevar) {
echo "Now showing: ". <... code to show var name .> ."\n";
9 matches
Mail list logo