Discussion: variable
Afficher un message
Vieux 17/09/2007, 04h11   #12
Jerry Stuckle
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: variable

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
==================
  Réponse avec citation
 
Page generated in 2,44107 seconds with 9 queries