You are here: Re: variable « PHP Programming Language « IT news, forums, messages
Re: variable

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]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация