<html>
<! Traverse1.php                                              >
<! Chapter 6, Oracle Database XE PHP Web Programming          >
<! by Michael McLaughlin                                      >
<!                                                            >
<! This script declares an array and then it resets the       >
<! pointer to the initial element and uses a for loop and     >
<! the next() function to read through items in the array.    >
<head>
<title>
  Chapter 6 : Traverse1.php
</title>
</head>
<body>
<?php
  // Declare an array variable.
  $salutation = array("Dr.","Mr.","Mrs.","Ms.");

  // Print the formatted contents.
  print "[".(print_r($salutation,true))."]<p>";

  // Set the array pointer to the initial element.
  reset($salutation);

  // Run once for the total of elements in the array.
  for ($i = 0;$i < count($salutation);$i++)
  {
    print "[".key($salutation)."][".current($salutation)."]<br>";
    next($salutation);
  }
?>
</body>
</html>
