1--TEST-- 2Test array_diff_uassoc() function : usage variation - Comparing integers with strings containing integers and float 3--FILE-- 4<?php 5echo "*** Testing array_diff_uassoc() : usage variation ***\n"; 6 7//Initialize variables 8$arr_default_int = array(1, 2, 3); 9$arr_string_int = array('1', '2'); 10$arr_string_float = array('0' => '1.00', '1.00' => '2.00'); 11 12function key_compare_func($key1, $key2) 13{ 14 if ($key1 === $key2) { 15 return 0; 16 } 17 return ($key1 > $key2)? 1:-1; 18} 19 20echo "\n-- Result of comparing integers and strings containing an integers --\n"; 21var_dump( array_diff_uassoc($arr_default_int, $arr_string_int, "key_compare_func") ); 22var_dump( array_diff_uassoc($arr_string_int, $arr_default_int, "key_compare_func") ); 23 24echo "\n-- Result of comparing integers and strings containing floating points --\n"; 25var_dump( array_diff_uassoc($arr_default_int, $arr_string_float, "key_compare_func") ); 26var_dump( array_diff_uassoc($arr_string_float, $arr_default_int, "key_compare_func") ); 27 28?> 29--EXPECT-- 30*** Testing array_diff_uassoc() : usage variation *** 31 32-- Result of comparing integers and strings containing an integers -- 33array(1) { 34 [2]=> 35 int(3) 36} 37array(0) { 38} 39 40-- Result of comparing integers and strings containing floating points -- 41array(3) { 42 [0]=> 43 int(1) 44 [1]=> 45 int(2) 46 [2]=> 47 int(3) 48} 49array(2) { 50 [0]=> 51 string(4) "1.00" 52 ["1.00"]=> 53 string(4) "2.00" 54} 55