1--TEST--
2Test array_walk_recursive() function : usage variations - 'input' array with subarray
3--FILE--
4<?php
5/*
6 * Testing array_walk_recursive() with an array having subarrays as elements
7*/
8
9echo "*** Testing array_walk_recursive() : array with subarray ***\n";
10
11function callback($value, $key)
12{
13   // dump the arguments to check that they are passed
14   // with proper type
15   var_dump($key);  // key
16   var_dump($value); // value
17   echo "\n"; // new line to separate the output between each element
18}
19
20$input = array(
21  array(),
22  array(1),
23  array(1,2,3),
24  array("Mango", "Orange"),
25  array(array(1, 2, 3), array(1))
26);
27
28var_dump( array_walk_recursive( $input, "callback"));
29
30echo "Done"
31?>
32--EXPECT--
33*** Testing array_walk_recursive() : array with subarray ***
34int(0)
35int(1)
36
37int(0)
38int(1)
39
40int(1)
41int(2)
42
43int(2)
44int(3)
45
46int(0)
47string(5) "Mango"
48
49int(1)
50string(6) "Orange"
51
52int(0)
53int(1)
54
55int(1)
56int(2)
57
58int(2)
59int(3)
60
61int(0)
62int(1)
63
64bool(true)
65Done
66