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)
 [EMAIL PROTECTED]
 www.phpbeginner.com




-----Original Message-----
From: Matthias Krehl [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, February 13, 2001 7:52 PM
To: [EMAIL PROTECTED]
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
[EMAIL PROTECTED]

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to