1--TEST-- 2Test array_diff_uassoc() function : usage variation - Comparing integers and floating point numbers 3--FILE-- 4<?php 5/* Prototype : array array_diff_uassoc(array arr1, array arr2 [, array ...], callback key_comp_func) 6 * Description: Computes the difference of arrays with additional index check which is performed by a 7 * user supplied callback function 8 * Source code: ext/standard/array.c 9 */ 10 11echo "*** Testing array_diff_uassoc() : usage variation ***\n"; 12 13//Initialize variables 14$arr_default_int = array(1, 2, 3, 4); 15$arr_float = array(0 => 1.00, 1.00 => 2.00, 2.00 => 3.00, 3.00 => 4.00); 16 17 18function key_compare_func($key1, $key2) 19{ 20 if ($key1 === $key2) { 21 return 0; 22 } 23 return ($key1 > $key2)? 1:-1; 24} 25 26echo "\n-- Result of comparing integers and floating point numbers --\n"; 27var_dump( array_diff_uassoc($arr_default_int, $arr_float, "key_compare_func") ); 28var_dump( array_diff_uassoc($arr_float, $arr_default_int, "key_compare_func") ); 29 30?> 31===DONE=== 32--EXPECTF-- 33*** Testing array_diff_uassoc() : usage variation *** 34 35-- Result of comparing integers and floating point numbers -- 36array(0) { 37} 38array(0) { 39} 40===DONE=== 41