RE: [PHP] foo[bar] _or_ foo['bar'] ?
| From: | PHPBeginner.com | Date: | Tue, 13 Feb 2001 14:34:16 +0000 |
| Subject: | RE: [PHP] foo[bar] _or_ foo['bar'] ? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-39424@lists.php.net to get a copy of this message | ||
foo['bar'];
Unless the array key (or any other kind of key, like these in functions or
in SQL statements) is an integer you should insert it between quotes.
Let's say that stings should be treated as 'strings' and integers can be
treated as integers.
Sincerely,
Maxim Maletsky
Founder, Chief Developer
PHPBeginner.com (Where PHP Begins)
maxim@phpbeginner.com
www.phpbeginner.com
-----Original Message-----
From: Matthias Krehl [mailto:matthias.krehl@key-work.de]
Sent: Tuesday, February 13, 2001 7:52 PM
To: php-general@lists.php.net
Subject: [PHP] foo[bar] _or_ foo['bar'] ?
Hi there!
I'd really appreciate a clear statement whether to use better
$foo = array('bar' => 'boing');
doWhatSoEver($foo[bar]);
or
$foo = array('bar' => 'boing');
doWhatSoEver($foo['bar']);
Someone to know that?
bye Matthias
Matthias Krehl
matthias.krehl@key-work.de
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
For additional commands, e-mail: php-general-help@lists.php.net
To contact the list administrators, e-mail: php-list-admin@lists.php.net