Annotation of embedaddon/php/ext/standard/tests/array/array_diff_uassoc_variation10.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: Test array_diff_uassoc() function : usage variation - Passing float indexed array
3: --FILE--
4: <?php
5: /* Prototype : array array_diff_uassoc(array arr1, array arr2 [, array ...], callback key_comp_func)
6: * Description: Computes the difference of arrays with additional index check which is performed by a
7: * user supplied callback function
8: * Source code: ext/standard/array.c
9: */
10:
11: echo "*** Testing array_diff_uassoc() : usage variation ***\n";
12:
13: // Initialise function arguments not being substituted (if any)
14: $input_array = array(0 => '0', 10 => '10', -10 => '-10', 20 =>'20', -20 => '-20');
15: $float_indx_array = array(0.0 => '0.0', 10.5 => '10.5', -10.5 => '-10.5', 0.5 => '0.5');
16:
17: echo "\n-- Testing array_diff_key() function with float indexed array --\n";
18: var_dump( array_diff_uassoc($input_array, $float_indx_array, "strcasecmp") );
19: var_dump( array_diff_uassoc($float_indx_array, $input_array, "strcasecmp") );
20:
21: ?>
22: ===DONE===
23: --EXPECTF--
24: *** Testing array_diff_uassoc() : usage variation ***
25:
26: -- Testing array_diff_key() function with float indexed array --
27: array(5) {
28: [0]=>
29: string(1) "0"
30: [10]=>
31: string(2) "10"
32: [-10]=>
33: string(3) "-10"
34: [20]=>
35: string(2) "20"
36: [-20]=>
37: string(3) "-20"
38: }
39: array(3) {
40: [0]=>
41: string(3) "0.5"
42: [10]=>
43: string(4) "10.5"
44: [-10]=>
45: string(5) "-10.5"
46: }
47: ===DONE===
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>