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