<html>
<! Shifting.php                                               >
<! Chapter 6, Oracle Database XE PHP Web Programming          >
<! by Michael McLaughlin                                      >
<!                                                            >
<! This script declares an array, unshifts or adds a variable >
<! to the front of the array and prints it, and then shifts   >
<! or removes the variable from the array.                    >
<head>
<title>
  Chapter 6 : Shifting.php
</title>
</head>
<body>
<?php
  // Declare array variable.
  $salutation = array("Dr.","Mr.","Mrs.","Ms.");

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

  // Unshift or add an element to the front of an array.
  if (array_unshift($salutation,"Lord"))
    print "[".(print_r($salutation,true))."].<p>";

  // Shift or remove an element from the front of an array.
  if (array_shift($salutation))
    print "[".(print_r($salutation,true))."].<p>";

?>
</body>
</html>