Re: Bizarre array key 'feature'?
| From: | Andi Gutmans | Date: | Thu, 09 Nov 2000 22:33:17 +0000 |
| Subject: | Re: Bizarre array key 'feature'? | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-37616@lists.php.net to get a copy of this message | ||
Just to reinforce this answer. You should always quote your strings. The only reason why unquoted names work is for backwards compatibility. Actually these are treated as constants and only if the constant doesn't exist will it be used as a string and I think it outputs an E_NOTICE to tell you to fix it :)
Andi
At 11:53 AM 11/9/00 +0100, Derick Rethans wrote:
Hi John, use $ourArray["default"]["a"] and error will probably go away. Derick John Parker wrote: Hi, all. Hmm.. bit of a strange one, this... Is 'default' considered a reserved word in the construction of muti-dimensional arrays? ie: The following code works. $ourArray[test][a] = true; $ourArray[test][b] = false; ... But the following fails (Parse error: parse error, expecting `']'') at the first line containing the 'default' key. $ourArray[default][a] = true; $ourArray[default][b] = false; Using PHP4.0.2 (yeah, I know I should probably upgrade). Thanks in advance, JP. --------------------------------------------------------------------- Andi Gutmans <andi@zend.com> http://www.zend.com/John Parker email: jparker@itchannel.netInternet Project Manager/Software Engineer web:www.itchannel.netitCHANNEL International Ltd. tel: +44 (0) 1202 291939-- PHP Development Mailing List <http://www.php.net/> To unsubscribe, e-mail: php-dev-unsubscribe@lists.php.net For additional commands, e-mail: php-dev-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net -- Derick Rethans JDI Media Solutions H.v.Tussenbroekstraat 1 6952 BL Dieren The Netherlands e-mail: d.rethans@jdimedia.nl http://www.jdimedia.nl/ -- PHP Development Mailing List <http://www.php.net/> To unsubscribe, e-mail: php-dev-unsubscribe@lists.php.net For additional commands, e-mail: php-dev-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net