1--TEST--
2Test array_map() function : usage variations - array having subarrays
3--FILE--
4<?php
5/*
6 * Test array_map() by passing array having different subarrays
7 */
8
9echo "*** Testing array_map() : array having subarrays ***\n";
10
11function callback($a)
12{
13  return $a;
14}
15
16// different subarrays
17$arr1 = array(
18  array(),
19  array(1, 2),
20  array('a', 'b'),
21  array(1, 2, 'a', 'b'),
22  array(1 => 'a', 'b' => 2)
23);
24
25var_dump( array_map('callback', $arr1));
26echo "Done";
27?>
28--EXPECT--
29*** Testing array_map() : array having subarrays ***
30array(5) {
31  [0]=>
32  array(0) {
33  }
34  [1]=>
35  array(2) {
36    [0]=>
37    int(1)
38    [1]=>
39    int(2)
40  }
41  [2]=>
42  array(2) {
43    [0]=>
44    string(1) "a"
45    [1]=>
46    string(1) "b"
47  }
48  [3]=>
49  array(4) {
50    [0]=>
51    int(1)
52    [1]=>
53    int(2)
54    [2]=>
55    string(1) "a"
56    [3]=>
57    string(1) "b"
58  }
59  [4]=>
60  array(2) {
61    [1]=>
62    string(1) "a"
63    ["b"]=>
64    int(2)
65  }
66}
67Done
68