[thelist] PHP - need clarification of quotes in array names.
Donald Noble
donaldrnoble at yahoo.com
Tue Feb 5 10:21:01 CST 2002
Hi, I'm quite new to PHP, and having a bit of trouble with Arrays,
The manual says $foo[bar] is wrong, and appears to say I should use
$foo['bar']. OK
How then do I echo $foo['bar'] as part of a string? if I have:
$foo['bar'] = "hello";
echo "$foo['bar'] world";
This gives an error.
If I have
$foo['bar'] = "hello";
echo "$foo[bar] world";
This works, but is it wrong?
Or should I write
$foo['bar'] = "hello";
echo $foo['bar']." world";
which is a bit more work.
Is $foo[0] the correct way to access the first value in the array $foo? or
does that need quotes too!
Please help a very confused newbie,
Cheers, Donald
PS. Any links to pages on how to write clean efficient coding are much
appreciated.
----------------------------------------------
http://www.AccessibleComputers.co.uk
Hardware, Software & Custom built PC Systems
----------------------------------------------
_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com
More information about the thelist
mailing list