Page 1 of 1

array thing

Posted: Sat Oct 11, 2008 2:49 pm
by rags
I am a php newbie..........just been a few days since ive started practising php and my first post on this forum........ heres the confusing code.......

Code: Select all

<?php
    $census_data = array(('New York'    => array('NY' => 8008278)));
?>
 
It gives me an error .......

PHP Parse error: syntax error, unexpected T_DOUBLE_ARROW in

but when i remove the extra pair of brackets inside the array function it seems to work just fine.....
i cant seem to understand why would the interpreter have a problem with that......... its syntactically proper in all the other languages that ive encountered up until now ........ could you throw some light on it....

thanks guys

Re: array thing

Posted: Sat Oct 11, 2008 4:33 pm
by mattcooper
rags wrote:could you throw some light on it....
Yeah, this is PHP and not the other languages you're used to; it has its own nuances. You've found the answer already and you now appear to have a new question about the interpreter itself... ;)

I learned long ago, "when in doubt, RTFM"