Jump to content

[SOLVED] array syntax question


silverglade

Recommended Posts

hi, i have a question about the  following array statement

 

$capitals = array ("CA" => "Sacramento",
                        "TX" => "Austin",
                         "OR" => "Salem");

 

i was wondering what the "=>" operator means, as it differs somehow from the = operator. any help greatly appreciated, thank you, ,derek

Link to comment
https://forums.phpfreaks.com/topic/117721-solved-array-syntax-question/
Share on other sites

you will also see it here:

 

$capitals = array ("CA" => "Sacramento",
                        "TX" => "Austin",
                         "OR" => "Salem");


foreach($capitals as $state => $city){
     echo $city.' is the capital of '.$state.'<br />';
}

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.