Re: GLOBAL[as]

From: Date: Thu, 14 Sep 2000 11:18:18 +0000
Subject: Re: GLOBAL[as]
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-16749@lists.php.net to get a copy of this message
Hi meling! On Thu, 14 Sep 2000, meling wrote: > While helping a developer debugging a code today, > we found that having a line like this: > > $ans = GLOBALS[as] > > will give a parse error (expecting "]"). However, when > the same code is run on PHP 3.0.7 (we have a development > server that has not been upgraded yet - my bad) it worked. > > Is as] a reserved word in PHP 4.0.0? Or a bug. When I tested > the same line on PHP 4.0.2, it worked... In PHP3 `as' was not a keyword. Now it is foreach ($arr as $k =>$v) ..............^ so you must not be lazy :) and add the appropriate quotes: $ans = GLOBALS['as']; gl -- teodor

« previous php.general (#16749) next »