array()

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
jamal
Forum Commoner
Posts: 57
Joined: Sat Oct 26, 2002 7:53 pm
Location: London

array()

Post by jamal »

Hi Guys,
This may sound very elementary to the expert but to me it
is another Vietnam war. Please can anyone just tell me
why the indexes of the element in the first array() contain
double quotes and the second array does not???

&sound = array ("pig"=>"oink","cow"=>"moo"); and
&measure = array ("inch"=>1,"foot"=>12, "yard"=>36);


Thanks
Jamal
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

in both arrays the indices are quoted, but in the second the values are not because they are numerical, integers in this case. Only quote string literals

http://www.php.net/manual/en/language.types.php
Post Reply