|
Posted by Jerry Stuckle on 09/17/07 02:11
Sanders Kaufman wrote:
> Michael Fesser wrote:
>
>> A variable variable is something like that:
>>
>> $foo = 'bar';
>> $bar = 42;
>>
>> print ${$foo}; // prints 42
>>
>> This means the name of the variable is taken from another (string)
>> variable. The same can be done with superglobals, but not if you're
>> inside a function or method:
>>
>> function test() {
>> $foo = '_GET';
>> var_dump(${$foo}); // throws a notice
>> }
>
> I think that what's confusing me is that double-dollar thing.
> I've seen it before, but thought it was a typo.
>
> Could you tell me what it means, or where to look in the docs to find
> out about it.
Sanders,
Not unusual. It is confusing, and IMHO not a good programming
technique, IMHO.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================
Navigation:
[Reply to this message]
|