1--TEST-- 2Test array_intersect_uassoc() function : usage variation - Intersection of strings containing integers, float 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$arr1_string_int = array('1', '2'); 14$arr2_string_int = array('1', '3'); 15$arr1_string_float = array('1.00', '2.00'); 16$arr2_string_float = array('1.00', '3.00'); 17 18function key_compare_func($a, $b) 19{ 20 if ($a === $b) { 21 return 0; 22 } 23 return ($a > $b)? 1:-1; 24} 25 26echo "\n-- Result of strings containing integers intersection --\n"; 27var_dump( array_intersect_uassoc($arr1_string_int, $arr2_string_int, "key_compare_func") ); 28 29echo "\n-- Result of strings containing floating points intersection --\n"; 30var_dump( array_intersect_uassoc($arr1_string_float, $arr2_string_float, "key_compare_func") ); 31 32echo "\n-- Result of strings containing integers and strings containing floating points intersection --\n"; 33var_dump( array_intersect_uassoc($arr1_string_int, $arr2_string_float, "key_compare_func") ); 34?> 35===DONE=== 36--EXPECTF-- 37*** Testing array_intersect_uassoc() : usage variation *** 38 39-- Result of strings containing integers intersection -- 40array(1) { 41 [0]=> 42 string(1) "1" 43} 44 45-- Result of strings containing floating points intersection -- 46array(1) { 47 [0]=> 48 string(4) "1.00" 49} 50 51-- Result of strings containing integers and strings containing floating points intersection -- 52array(0) { 53} 54===DONE=== 55