1--TEST--
2Test array_map() function : usage variations - with recursive callback
3--FILE--
4<?php
5/*
6 * Test array_map() by passing subarrays and recursive callback function
7 */
8
9echo "*** Testing array_map() : recursive callback function ***\n";
10
11function square_recur_single_array($var) {
12   if (is_array($var))
13     return array_map('square_recur_single_array', $var);
14   return $var * $var;
15}
16
17$array1 = array(1, array(2, 3, array(5)), array(4));
18
19var_dump( array_map('square_recur_single_array', $array1));
20
21echo "Done";
22?>
23--EXPECT--
24*** Testing array_map() : recursive callback function ***
25array(3) {
26  [0]=>
27  int(1)
28  [1]=>
29  array(3) {
30    [0]=>
31    int(4)
32    [1]=>
33    int(9)
34    [2]=>
35    array(1) {
36      [0]=>
37      int(25)
38    }
39  }
40  [2]=>
41  array(1) {
42    [0]=>
43    int(16)
44  }
45}
46Done
47