1--TEST--
2Test array_key_exists() function : usage variations - multidimensional arrays
3--FILE--
4<?php
5/* Prototype  : bool array_key_exists(mixed $key, array $search)
6 * Description: Checks if the given key or index exists in the array
7 * Source code: ext/standard/array.c
8 * Alias to functions: key_exists
9 */
10
11/*
12 * Test how array_key_exists() behaves with multi-dimensional arrays
13 */
14
15echo "*** Testing array_key_exists() : usage variations ***\n";
16
17$multi_array = array ('zero' => 'val1',
18                      'one' => 'val2',
19                      'sub1' => array (1, 2, 3));
20
21echo "\n-- Attempt to match key in sub-array --\n";
22// this key is in the sub-array
23var_dump(array_key_exists(0, $multi_array));
24
25echo "\n-- \$search arg points to sub-array --\n";
26var_dump(array_key_exists(0, $multi_array['sub1']));
27
28echo "Done";
29?>
30
31--EXPECTF--
32*** Testing array_key_exists() : usage variations ***
33
34-- Attempt to match key in sub-array --
35bool(false)
36
37-- $search arg points to sub-array --
38bool(true)
39Done