[thelist] PHP - need clarification of quotes in array names.

R.Livsey R.Livsey at cache-22.co.uk
Tue Feb 5 10:30:00 CST 2002


> Hi, I'm quite new to PHP, and having a bit of trouble with Arrays,
>
> OK How then do I echo $foo['bar'] as part of a string? if I have:

Yeah, you have to access arrays outside of strings - ie echo
$foo['bar']." world";

> Is $foo[0] the correct way to access the first value in the
> array $foo? or does that need quotes too!
>

No, numerical values must be outside of string terminators.
Ie
$foo['bar'] for named array places,
$foo[0] for numeric places.

> Please help a very confused newbie,
> Cheers, Donald

No problem.

> PS. Any links to pages on how to write clean efficient coding
> are much appreciated.

http://www.devshed.com
http://www.phpbuilder.com
Of course http://www.evolt.org has some good stuff on PHP IIRC.
My site, http://www.cache-22.co.uk has a few tutorials, plus the whole
site is open source so you can view the PHP code of every page to see
whats going on.

HTH

--
R.Livsey
[ PHP | Perl | mySQL | Java ]
w : cache-22.co.uk
e : R.Livsey at cache-22.co.uk
m : +447764 685 701
i : 37530949




More information about the thelist mailing list