key: Fetch a key from an associative array : Associative Array : Data Structure PHP Source Code


PHP Source Code » Data Structure » Associative Array »

 

key: Fetch a key from an associative array




<?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);
   }
?>
           
       



HTML code for linking to this page:

Follow Navioo On Twitter

PHP Source Code

 Navioo Data Structure
» Associative Array