1--TEST-- 2Test array_intersect_uassoc() function : usage variation - Intersection of floating points with strings. 3--FILE-- 4<?php 5/* Prototype : array array_intersect_uassoc(array arr1, array arr2 [, array ...], callback key_compare_func) 6 * Description: Computes the intersection of arrays with additional index check, compares indexes by a callback function 7 * Source code: ext/standard/array.c 8 */ 9 10echo "*** Testing array_intersect_uassoc() : usage variation ***\n"; 11 12//Initialize variables 13$arr_float = array(0 => 1.00, 1.00 => 2.00); 14$arr_string = array('1', '2', '3'); 15$arr_string_float = array('1.00', '2.00'); 16 17function key_compare_func($a, $b) 18{ 19 if ($a === $b) { 20 return 0; 21 } 22 return ($a > $b)? 1:-1; 23} 24 25echo "\n-- Result of floating points and strings containing integers intersection --\n"; 26var_dump( array_intersect_uassoc($arr_float, $arr_string, "key_compare_func") ); 27 28echo "\n-- Result of floating points and strings containing floating point intersection --\n"; 29var_dump( array_intersect_uassoc($arr_float, $arr_string_float, "key_compare_func") ); 30?> 31===DONE=== 32--EXPECTF-- 33*** Testing array_intersect_uassoc() : usage variation *** 34 35-- Result of floating points and strings containing integers intersection -- 36array(2) { 37 [0]=> 38 float(1) 39 [1]=> 40 float(2) 41} 42 43-- Result of floating points and strings containing floating point intersection -- 44array(0) { 45} 46===DONE=== 47