1--TEST--
2Test array_chunk() function : usage variations - references
3--FILE--
4<?php
5/*
6 * Testing array_chunk() function with following conditions
7 *   1. input array containing references
8*/
9
10echo "*** Testing array_chunk() : usage variations ***\n";
11
12$size = 2;
13
14echo "\n-- Testing array_chunk(), input array containing references \n";
15
16$numbers=array(1, 2, 3, 4);
17// reference array
18$input_array = array (
19  "one" => &$numbers[0],
20  "two" => &$numbers[1],
21  "three" => &$numbers[2],
22  "four" => &$numbers[3]
23);
24
25var_dump( array_chunk($input_array, $size) );
26var_dump( array_chunk($input_array, $size, true) );
27var_dump( array_chunk($input_array, $size, false) );
28
29echo "Done";
30?>
31--EXPECT--
32*** Testing array_chunk() : usage variations ***
33
34-- Testing array_chunk(), input array containing references
35array(2) {
36  [0]=>
37  array(2) {
38    [0]=>
39    &int(1)
40    [1]=>
41    &int(2)
42  }
43  [1]=>
44  array(2) {
45    [0]=>
46    &int(3)
47    [1]=>
48    &int(4)
49  }
50}
51array(2) {
52  [0]=>
53  array(2) {
54    ["one"]=>
55    &int(1)
56    ["two"]=>
57    &int(2)
58  }
59  [1]=>
60  array(2) {
61    ["three"]=>
62    &int(3)
63    ["four"]=>
64    &int(4)
65  }
66}
67array(2) {
68  [0]=>
69  array(2) {
70    [0]=>
71    &int(1)
72    [1]=>
73    &int(2)
74  }
75  [1]=>
76  array(2) {
77    [0]=>
78    &int(3)
79    [1]=>
80    &int(4)
81  }
82}
83Done
84