<html>
<! Diff.php                                                   >
<! Chapter 6, Oracle Database XE PHP Web Programming          >
<! by Michael McLaughlin                                      >
<!                                                            >
<! This script declares two arrays, merges them into one      >
<! array, then demonstrates the array_diff() function using   >
<! one of the base arrays and the merged array.               >
<head>
<title>
  Chapter 6 : Diff.php
</title>
</head>
<body>
<?php
  // Declare array variables.
  $americanLeague = array("Boston","N.Y. Yankees");
  $nationalLeague = array("Dodgers","Giants");

  // Declare an empty array.
  $majorLeague = array();

  // Print structured ordering.
  print "[American]<br>[".print_r($americanLeague,true)."].<br>";
  print "[National]<br>[".print_r($nationalLeague,true)."].<br><hr>";

  // Merge array members.
  $majorLeague = array_merge($americanLeague,$nationalLeague);

  // Print restructured ordering.
  print "[Major League]<br>[".print_r($majorLeague,true)."].<br><hr>";

  $americanLeague = array_diff($majorLeague,$nationalLeague);
  print "[Major League - American League]<br>";
  print "[".print_r($americanLeague,true)."].<br>";
?>
</body>
</html>
