Switch to full style
:read: Start PHP with us. Includes topics to help you in php
Post a reply

Fetch a key from an associative array

Tue Oct 28, 2008 1:38 am

Code:
<?php
   $capitals
= array("Ohio" => "Columbus", "Iowa" => "Des Moines","Arizona" => "Phoenix");
   echo
"<p>Can you name the capitals of these states?</p>";
   while(
$key = key($capitals)) {
      echo
$key."<br />";
      
next($capitals);
   }
?>




Post a reply
  Related Posts  to : Fetch a key from an associative array
 Sort associative array     -  
 foreach to loop through an associative array     -  
 Array difference for associate array     -  
 compare an array with another array?     -  
 Average of an array. Please help     -  
 Imploding an Array     -  
 array unshift     -  
 Array sort     -  
 Array size to zero     -  
 C++ array copying     -  

Topic Tags

PHP Arrays