1--TEST--
2Test array_fill() function : usage variations - using return value of array_fill for 'val' argument
3--FILE--
4<?php
5/* passing array_fill() as the 'val' argument in array_fill() function */
6
7echo "*** Testing array_fill() : variation ***\n";
8
9$start_key = 0;
10$num = 2;
11$heredoc = <<<HERE_DOC
12Hello
13HERE_DOC;
14
15// array of possible valid values for 'val' argument
16$values = array (
17
18  /* 1  */  NULL,
19            0,
20            1,
21  /* 4  */  1.0,
22            'hi',
23            "hi",
24  /* 7  */  $heredoc
25);
26
27echo "*** Filling 2 dimensional array with all basic valid values ***\n";
28$counter = 1;
29for($i =0; $i < count($values); $i ++)
30{
31  echo "-- Iteration $counter --\n";
32  $val = $values[$i];
33
34  var_dump( array_fill($start_key,$num,array_fill($start_key,$num,$val)) );
35
36  $counter++;
37}
38
39echo "Done";
40?>
41--EXPECT--
42*** Testing array_fill() : variation ***
43*** Filling 2 dimensional array with all basic valid values ***
44-- Iteration 1 --
45array(2) {
46  [0]=>
47  array(2) {
48    [0]=>
49    NULL
50    [1]=>
51    NULL
52  }
53  [1]=>
54  array(2) {
55    [0]=>
56    NULL
57    [1]=>
58    NULL
59  }
60}
61-- Iteration 2 --
62array(2) {
63  [0]=>
64  array(2) {
65    [0]=>
66    int(0)
67    [1]=>
68    int(0)
69  }
70  [1]=>
71  array(2) {
72    [0]=>
73    int(0)
74    [1]=>
75    int(0)
76  }
77}
78-- Iteration 3 --
79array(2) {
80  [0]=>
81  array(2) {
82    [0]=>
83    int(1)
84    [1]=>
85    int(1)
86  }
87  [1]=>
88  array(2) {
89    [0]=>
90    int(1)
91    [1]=>
92    int(1)
93  }
94}
95-- Iteration 4 --
96array(2) {
97  [0]=>
98  array(2) {
99    [0]=>
100    float(1)
101    [1]=>
102    float(1)
103  }
104  [1]=>
105  array(2) {
106    [0]=>
107    float(1)
108    [1]=>
109    float(1)
110  }
111}
112-- Iteration 5 --
113array(2) {
114  [0]=>
115  array(2) {
116    [0]=>
117    string(2) "hi"
118    [1]=>
119    string(2) "hi"
120  }
121  [1]=>
122  array(2) {
123    [0]=>
124    string(2) "hi"
125    [1]=>
126    string(2) "hi"
127  }
128}
129-- Iteration 6 --
130array(2) {
131  [0]=>
132  array(2) {
133    [0]=>
134    string(2) "hi"
135    [1]=>
136    string(2) "hi"
137  }
138  [1]=>
139  array(2) {
140    [0]=>
141    string(2) "hi"
142    [1]=>
143    string(2) "hi"
144  }
145}
146-- Iteration 7 --
147array(2) {
148  [0]=>
149  array(2) {
150    [0]=>
151    string(5) "Hello"
152    [1]=>
153    string(5) "Hello"
154  }
155  [1]=>
156  array(2) {
157    [0]=>
158    string(5) "Hello"
159    [1]=>
160    string(5) "Hello"
161  }
162}
163Done
164