1--TEST-- 2Test array_diff_uassoc() function : usage variation - Comparing floating points with strings having integers and float 3--FILE-- 4<?php 5echo "*** Testing array_diff_uassoc() : usage variation ***\n"; 6 7//Initialize variables 8$arr_float = array(0 => 1.00, 1 => 2.00); 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 floating points and strings containing integers --\n"; 21var_dump( array_diff_uassoc($arr_float, $arr_string_int, "key_compare_func") ); 22var_dump( array_diff_uassoc($arr_string_int, $arr_float, "key_compare_func") ); 23 24echo "\n-- Result of comparing floating points and strings containing floating point --\n"; 25var_dump( array_diff_uassoc($arr_float, $arr_string_float, "key_compare_func") ); 26var_dump( array_diff_uassoc($arr_string_float, $arr_float, "key_compare_func") ); 27 28?> 29--EXPECT-- 30*** Testing array_diff_uassoc() : usage variation *** 31 32-- Result of comparing floating points and strings containing integers -- 33array(0) { 34} 35array(0) { 36} 37 38-- Result of comparing floating points and strings containing floating point -- 39array(2) { 40 [0]=> 41 float(1) 42 [1]=> 43 float(2) 44} 45array(2) { 46 [0]=> 47 string(4) "1.00" 48 ["1.00"]=> 49 string(4) "2.00" 50} 51