silverglade Posted August 1, 2008 Share Posted August 1, 2008 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 More sharing options...
DarkWater Posted August 1, 2008 Share Posted August 1, 2008 That's just how PHP assigns array keys to array values. Link to comment https://forums.phpfreaks.com/topic/117721-solved-array-syntax-question/#findComment-605477 Share on other sites More sharing options...
The Little Guy Posted August 1, 2008 Share Posted August 1, 2008 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 />'; } Link to comment https://forums.phpfreaks.com/topic/117721-solved-array-syntax-question/#findComment-605481 Share on other sites More sharing options...
silverglade Posted August 1, 2008 Author Share Posted August 1, 2008 ok thank you very much. derek Link to comment https://forums.phpfreaks.com/topic/117721-solved-array-syntax-question/#findComment-605488 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.