Annotation of embedaddon/php/ext/standard/tests/array/array_diff_ukey_variation6.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: Test array_diff_ukey() function : usage variation - Passing integer indexed array
3: --FILE--
4: <?php
5: /* Prototype : array array_diff_ukey(array arr1, array arr2 [, array ...], callback key_comp_func)
6: * Description: Returns the entries of arr1 that have keys which are not present in any of the others arguments.
7: * Source code: ext/standard/array.c
8: */
9:
10: echo "*** Testing array_diff_ukey() : usage variation ***\n";
11:
12: // Initialise function arguments not being substituted (if any)
13: $input_array = array(-07 => '-07', 0xA => '0xA');
14:
15: $input_arrays = array(
16: 'decimal indexed' => array(10 => '10', '-17' => '-17'),
17: 'octal indexed' => array(-011 => '-011', 012 => '012'),
18: 'hexa indexed' => array(0x12 => '0x12', -0x7 => '-0x7', ),
19: );
20:
21: function key_compare_func($key1, $key2)
22: {
23: return strcasecmp($key1, $key2);
24: }
25:
26: foreach($input_arrays as $key =>$value) {
27: echo "\n--$key--\n";
28: var_dump( array_diff_ukey($value, $input_array, 'key_compare_func') );
29: var_dump( array_diff_ukey($input_array, $value, 'key_compare_func') );
30: }
31: ?>
32: ===DONE===
33: --EXPECTF--
34: *** Testing array_diff_ukey() : usage variation ***
35:
36: --decimal indexed--
37: array(1) {
38: [-17]=>
39: string(3) "-17"
40: }
41: array(1) {
42: [-7]=>
43: string(3) "-07"
44: }
45:
46: --octal indexed--
47: array(1) {
48: [-9]=>
49: string(4) "-011"
50: }
51: array(1) {
52: [-7]=>
53: string(3) "-07"
54: }
55:
56: --hexa indexed--
57: array(1) {
58: [18]=>
59: string(4) "0x12"
60: }
61: array(1) {
62: [10]=>
63: string(3) "0xA"
64: }
65: ===DONE===
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>