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?     -  
 Pad array to the specified length with a value     -  
 XML Document into an Array in php     -  
 Shuffle Array     -  
 Pop the element off the end of array     -  
 Here is how to display any 2d array     -  
 PHP Array Functions     -  

Topic Tags

PHP Arrays