NYCPHP Meetup

NYPHP.org

[nycphp-talk] Output name of Variable

Jim Musil jim at nettmedia.com
Fri Jan 31 13:06:32 EST 2003


Right. But I want it to output the NAME of the variable, not the VALUE...


Jim Musil
<jim at nettmedia.com>
Nettmedia, Senior Developer
345 Seventh Ave., 24th Floor.
New York, NY 10001
Tel. 212.629.0004 x 131



On 1/31/03 1:03 PM, "Aaron Fischer" <agfische at email.smith.edu> wrote:

> I think it's simpler then that:
> 
> $foo="bar";
> 
> then:
> 
> echo $foo;
>  will output the value of the variable
> 
> Aaron
> 
> 
> On Friday, January 31, 2003, at 01:00 PM, Brian wrote:
> 
>> I was kinda wondering how that worked.  Doesn't really apply to the
>> original
>> question then.  Answered one for me then, thanks.
>> 
>> Brian
>> 
>> On Friday 31 January 2003 12:51 pm, Jim Musil wrote:
>>> I don't think so. I think this would allow the name of a variable to
>>> be
>>> dynamic.
>>> 
>>> eg:
>>> 
>>> $foo = "bar";
>>> $bar = "This is the value of my variable";
>>> 
>>> ..
>>> 
>>> echo $$foo;
>>> 
>>> .. will output "This is the value of my variable"
>>> 
>>> 
>>> 
>>> Jim Musil
>>> <jim at nettmedia.com>
>>> Nettmedia, Senior Developer
>>> 345 Seventh Ave., 24th Floor.
>>> New York, NY 10001
>>> Tel. 212.629.0004 x 131
>>> 
>>> On 1/31/03 12:41 PM, "Brian" <brian at preston-campbell.com> wrote:
>>>> I have never used it, so I may be wrong, but I think what you need is
>>>> 
>>>> $$variable
>>>> 
>>>> On Friday 31 January 2003 12:37 pm, Jim Musil wrote:
>>>>> It seems like it would be helpful if there were a way to grab the
>>>>> name
>>>>> assigned to a variable and output it. Is there already a function
>>>>> like
>>>>> this?
>>>>> 
>>>>> I would use this mainly for tracing and reporting. So, if I had a
>>>>> simple
>>>>> function show_variable($var), it would not only output the value
>>>>> assigned to the variable, but would also show the name of the
>>>>> variable
>>>>> itself.
>>>>> 
>>>>> Am I missing it?
>>>>> 
>>>>> 
>>>>> Jim Musil
>>>>> <jim at nettmedia.com>
>>>>> Nettmedia, Senior Developer
>>>>> 345 Seventh Ave., 24th Floor.
>>>>> New York, NY 10001
>>>>> Tel. 212.629.0004 x 131
>>> 
>>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
> 
> 
> 
> --- Unsubscribe at http://nyphp.org/list/ ---
> 
> 




More information about the talk mailing list