<html>
<! ArrayValues.php                                            >
<! Chapter 6, Oracle Database XE PHP Web Programming          >
<! by Michael McLaughlin                                      >
<!                                                            >
<! This declares an array by assigning all elements, then     >
<! it uses a array_values function to copy and re-sequence    >
<! a numeric array.                                           >
<head>
<title>
  Chapter 6 : ArrayValues.php
</title>
</head>
<body>
<?php
  // Declare variable.
  $salutation = array("Dr.","Mr.","Mrs.","Ms.");

  // Declare the variable externally to a if statement.
  $output = "Array ( ";

  // Remove an element from an array.
  unset($salutation[2]);

  // Reset index keys from sparse to dense.
  $salutation = array_values($salutation);

  // Read and add array keys and values to a string.
  for ($i = 0;$i < count($salutation);$i++)
    $output .= " [".$i."] => ".$salutation[$i];

  // Append closing parenthesis.
  $output .= ")";

  // Print the formatted contents.
  print "[".$output."].";
?>
</body>
</html>