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 Quote Link to comment 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. Quote Link to comment 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 />'; } Quote Link to comment Share on other sites More sharing options...
silverglade Posted August 1, 2008 Author Share Posted August 1, 2008 ok thank you very much. derek Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.