1--TEST--
2Test array_intersect_key() function : usage variation - Passing Multi dimensional 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$array1 = array(
14
15	  'first' => array('blue'  => 1, 'red'  => 2),
16
17      'second' => array('yellow' => 7),
18
19      'third' => array(0 =>'zero'),
20);
21
22$array2 = array (
23
24	  'first' => array('blue'  => 1, 'red'  => 2,),
25
26      'second' => array('cyan'   => 8),
27
28      'fourth' => array(2 => 'two'),
29);
30var_dump( array_intersect_key($array1, $array2) );
31var_dump( array_intersect_key($array2,$array1 ) );
32?>
33===DONE===
34--EXPECT--
35*** Testing array_intersect_key() : usage variation ***
36array(2) {
37  ["first"]=>
38  array(2) {
39    ["blue"]=>
40    int(1)
41    ["red"]=>
42    int(2)
43  }
44  ["second"]=>
45  array(1) {
46    ["yellow"]=>
47    int(7)
48  }
49}
50array(2) {
51  ["first"]=>
52  array(2) {
53    ["blue"]=>
54    int(1)
55    ["red"]=>
56    int(2)
57  }
58  ["second"]=>
59  array(1) {
60    ["cyan"]=>
61    int(8)
62  }
63}
64===DONE===
65