<html>
<! Merge.php                                                  >
<! Chapter 6, Oracle Database XE PHP Web Programming          >
<! by Michael McLaughlin                                      >
<!                                                            >
<! This script declares two arrays and demonstrates the       >
<! merge() function by coverting elements to unique and then  >
<! reordering their keys.                                     >
<head>
<title>
  Chapter 6 : Merge.php
</title>
</head>
<body>
<?php
  // Declare two array variables.
  $one = array("Denmark","Finland","Iceland","Germany","Sweden");
  $two = array("Finland","Ireland","Iceland","Denmark","United Kingdom");

  // Sort the array members as unique.
  $uniqueMerge = array_unique(array_merge_recursive($one,$two));

  // Read and print spliced array keys and values to the page.
  foreach($uniqueMerge as $code => $name)
    print "[".$code."][".print_r($name,true)."]<br>";

  // Print a line break to the page.
  print "<hr>";

  // Sort merged array members as unique and reorder keys.
  $uniqueOrderedMerge = array_values(array_unique(array_merge($one,$two)));

  // Read and print spliced array keys and values to the page.
  foreach($uniqueOrderedMerge as $code => $name)
    print "[".$code."][".print_r($name,true)."]<br>";
?>
</body>
</html>
