<html>
<! ArraySearch1.php                                           >
<! Chapter 5, Oracle Database XE PHP Web Programming          >
<! by Michael McLaughlin                                      >
<!                                                            >
<! This declares an array by assigning all elements, then     >
<! it uses a array_search function to search and return a     >
<! matching value from the array.                             >
<head>
<title>
  Chapter 6 : ArraySearch1.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>";

  // Return the keys into an array.
  $result = array_search("Dr.",$salutation);

  // Print the value pointed to by the index key.
  print "[".$salutation[array_search("Dr.",$salutation)]."]";

?>
</body>
</html>
