Re: strange problem

From: Date: Fri, 18 Jan 2002 15:44:02 +0000
Subject: Re: strange problem
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-81097@lists.php.net to get a copy of this message
On Friday, January 18, 2002, at 09:52 AM, Nick Wilson wrote:
my PHP (PHP Version 4.1.1) suddenly does not take this anymore: $a['color'] = 'red'; I get this error: Parse error: parse error, expecting `T_STRING' or T_VARIABLE' or T_NUM_STRING' when I remove the quotes around the key, it works. Problem is , that a certain key is "%coding" (I know, I know, I should not use non-alphanumerics, but it used to work) and this key I cannot use anymore: php does not take %coding, nor '%coding', nor "%coding". Can someone help me out ? Marc
No idea, but a fella on this list told me [] had been deprecated in favour of {} Maybe that has something to do with it?
From what I understand (as a participant in that thread), [] hasn't been deprecated for all arrays, just the situations in which you want to consider a string as an array of characters and are using a numeric index to point to a specific character. Like so: $string = "abcdefg"; echo $string{3}; (should print "d" unless I'm doing this wrong). For most other arrays, brackets are still OK. Erik

« previous php.general (#81097) next »