1--TEST--
2Test array_intersect_key() function : usage variation - Passing integer 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
10echo "*** 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' , 02 => 'two', -07 => '-07', 0xA => '0xA', -0xC => '-0xc');
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
21foreach($input_arrays as $key =>$value) {
22      echo "\n--$key--\n";
23      var_dump( array_intersect_key($input_array, $value) );
24      var_dump( array_intersect_key($value,$input_array ) );
25}
26?>
27===DONE===
28--EXPECTF--
29*** Testing array_intersect_key() : usage variation ***
30
31--decimal indexed--
32array(1) {
33  [10]=>
34  string(3) "0xA"
35}
36array(1) {
37  [10]=>
38  string(2) "10"
39}
40
41--octal indexed--
42array(1) {
43  [10]=>
44  string(3) "0xA"
45}
46array(1) {
47  [10]=>
48  string(3) "012"
49}
50
51--hexa  indexed--
52array(1) {
53  [-7]=>
54  string(3) "-07"
55}
56array(1) {
57  [-7]=>
58  string(4) "-0x7"
59}
60===DONE===
61