Re: Variable array variables?

From: Date: Sun, 15 Oct 2000 04:15:21 +0000
Subject: Re: Variable array variables?
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-20210@lists.php.net to get a copy of this message
Matt McClanahan writes: > > This is PHP 4.0.4-dev, CVS from about 20 minutes ago. > > Has this worked as you described in prior versions? Never tried before. :) [trimmed] > So does this mean I just created a string variable named $foo[bar][name] Yup. > If I do a > > foreach ($GLOBALS as $key => $val) > echo "$key\n" > > foo[bar][name] does indeed show up. I wonder if that should be allowed? > > Matt Dunno. You can make PHP create all manner of 'illegal' variable names that way--illegal in the sense that they don't conform to PHP's variable naming rules. In cases like this, unless there's some other way to achieve the same thing, it would be pretty cool if PHP could tell the difference or at least attempt to evaluate the array form. I don't know whether this is something that would be easily doable with PHP's parser, though. -- +----------------------------------------------------------------+ |Torben Wilson <torben@php.net> Netmill iTech| |http://www.coastnet.com/~torben http://www.netmill.fi| |Ph: 1 250 383-9735 torben@netmill.fi| +----------------------------------------------------------------+

« previous php.general (#20210) next »