PHP 数组函数 array_diff_uassoc()


PHP 数组函数 array_diff_uassoc()

<?php
   function key_compare_func($a, $b) {
      if ($a === $b) {
         return 0;
      }
      return ($a > $b)? 1:-1;
   }

   $input1 = array("a" => "green", "b" => "brown", "c" => "blue", "red");
   $input2 = array("a" => "green", "yellow", "red");

   $result = array_diff_uassoc($input1, $input2, "key_compare_func");

   print_r($result);

?>