Annotation of embedaddon/php/ext/standard/tests/array/array_intersect_key_variation6.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: Test array_intersect_key() function : usage variation - Passing boolean indexed array
3: --FILE--
4: <?php
5: /* Prototype : array array_intersect_key(array arr1, array arr2 [, array ...])
6: * Description: Returns the entries of arr1 that have keys which are present in all the other arguments.
7: * Source code: ext/standard/array.c
8: */
9:
10: echo "*** Testing array_intersect_key() : usage variation ***\n";
11:
12: // Initialise function arguments not being substituted (if any)
13: $input_array = array(0 => '0', 1 => '1' , -10 => '-10');
14: $boolean_indx_array = array(true => 'boolt', false => 'boolf', TRUE => 'boolT', FALSE => 'boolF');
15:
16: echo "\n-- Testing array_intersect_key() function with boolean indexed array --\n";
17: var_dump( array_intersect_key($input_array, $boolean_indx_array) );
18: var_dump( array_intersect_key($boolean_indx_array,$input_array ) );
19: ?>
20: ===DONE===
21: --EXPECTF--
22: *** Testing array_intersect_key() : usage variation ***
23:
24: -- Testing array_intersect_key() function with boolean indexed array --
25: array(2) {
26: [0]=>
27: string(1) "0"
28: [1]=>
29: string(1) "1"
30: }
31: array(2) {
32: [1]=>
33: string(5) "boolT"
34: [0]=>
35: string(5) "boolF"
36: }
37: ===DONE===
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>