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