1--TEST-- 2basic array_fill test 3--FILE-- 4<?php 5$array1 = array(0.0, 1, 2.5); 6$array2 = array(TRUE, FALSE, NULL, "d", "e", "f"); 7foreach($array1 as $start) 8{ 9 foreach($array1 as $num) 10 { 11 foreach($array2 as $value) 12 { 13 echo '==========================='."\n"; 14 echo 'start: '.$start.' num: '.$num.' value: '.$value."\n"; 15 $output = array_fill($start, $num, $value); 16 var_dump($output); 17 } 18 } 19} 20echo '== Done =='; 21?> 22===============Done==================== 23--EXPECTF-- 24=========================== 25start: 0 num: 0 value: 1 26 27Warning: array_fill(): Number of elements must be positive in %s on line %d 28bool(false) 29=========================== 30start: 0 num: 0 value: 31 32Warning: array_fill(): Number of elements must be positive in %s on line %d 33bool(false) 34=========================== 35start: 0 num: 0 value: 36 37Warning: array_fill(): Number of elements must be positive in %s on line %d 38bool(false) 39=========================== 40start: 0 num: 0 value: d 41 42Warning: array_fill(): Number of elements must be positive in %s on line %d 43bool(false) 44=========================== 45start: 0 num: 0 value: e 46 47Warning: array_fill(): Number of elements must be positive in %s on line %d 48bool(false) 49=========================== 50start: 0 num: 0 value: f 51 52Warning: array_fill(): Number of elements must be positive in %s on line %d 53bool(false) 54=========================== 55start: 0 num: 1 value: 1 56array(1) { 57 [0]=> 58 bool(true) 59} 60=========================== 61start: 0 num: 1 value: 62array(1) { 63 [0]=> 64 bool(false) 65} 66=========================== 67start: 0 num: 1 value: 68array(1) { 69 [0]=> 70 NULL 71} 72=========================== 73start: 0 num: 1 value: d 74array(1) { 75 [0]=> 76 string(1) "d" 77} 78=========================== 79start: 0 num: 1 value: e 80array(1) { 81 [0]=> 82 string(1) "e" 83} 84=========================== 85start: 0 num: 1 value: f 86array(1) { 87 [0]=> 88 string(1) "f" 89} 90=========================== 91start: 0 num: 2.5 value: 1 92array(2) { 93 [0]=> 94 bool(true) 95 [1]=> 96 bool(true) 97} 98=========================== 99start: 0 num: 2.5 value: 100array(2) { 101 [0]=> 102 bool(false) 103 [1]=> 104 bool(false) 105} 106=========================== 107start: 0 num: 2.5 value: 108array(2) { 109 [0]=> 110 NULL 111 [1]=> 112 NULL 113} 114=========================== 115start: 0 num: 2.5 value: d 116array(2) { 117 [0]=> 118 string(1) "d" 119 [1]=> 120 string(1) "d" 121} 122=========================== 123start: 0 num: 2.5 value: e 124array(2) { 125 [0]=> 126 string(1) "e" 127 [1]=> 128 string(1) "e" 129} 130=========================== 131start: 0 num: 2.5 value: f 132array(2) { 133 [0]=> 134 string(1) "f" 135 [1]=> 136 string(1) "f" 137} 138=========================== 139start: 1 num: 0 value: 1 140 141Warning: array_fill(): Number of elements must be positive in %s on line %d 142bool(false) 143=========================== 144start: 1 num: 0 value: 145 146Warning: array_fill(): Number of elements must be positive in %s on line %d 147bool(false) 148=========================== 149start: 1 num: 0 value: 150 151Warning: array_fill(): Number of elements must be positive in %s on line %d 152bool(false) 153=========================== 154start: 1 num: 0 value: d 155 156Warning: array_fill(): Number of elements must be positive in %s on line %d 157bool(false) 158=========================== 159start: 1 num: 0 value: e 160 161Warning: array_fill(): Number of elements must be positive in %s on line %d 162bool(false) 163=========================== 164start: 1 num: 0 value: f 165 166Warning: array_fill(): Number of elements must be positive in %s on line %d 167bool(false) 168=========================== 169start: 1 num: 1 value: 1 170array(1) { 171 [1]=> 172 bool(true) 173} 174=========================== 175start: 1 num: 1 value: 176array(1) { 177 [1]=> 178 bool(false) 179} 180=========================== 181start: 1 num: 1 value: 182array(1) { 183 [1]=> 184 NULL 185} 186=========================== 187start: 1 num: 1 value: d 188array(1) { 189 [1]=> 190 string(1) "d" 191} 192=========================== 193start: 1 num: 1 value: e 194array(1) { 195 [1]=> 196 string(1) "e" 197} 198=========================== 199start: 1 num: 1 value: f 200array(1) { 201 [1]=> 202 string(1) "f" 203} 204=========================== 205start: 1 num: 2.5 value: 1 206array(2) { 207 [1]=> 208 bool(true) 209 [2]=> 210 bool(true) 211} 212=========================== 213start: 1 num: 2.5 value: 214array(2) { 215 [1]=> 216 bool(false) 217 [2]=> 218 bool(false) 219} 220=========================== 221start: 1 num: 2.5 value: 222array(2) { 223 [1]=> 224 NULL 225 [2]=> 226 NULL 227} 228=========================== 229start: 1 num: 2.5 value: d 230array(2) { 231 [1]=> 232 string(1) "d" 233 [2]=> 234 string(1) "d" 235} 236=========================== 237start: 1 num: 2.5 value: e 238array(2) { 239 [1]=> 240 string(1) "e" 241 [2]=> 242 string(1) "e" 243} 244=========================== 245start: 1 num: 2.5 value: f 246array(2) { 247 [1]=> 248 string(1) "f" 249 [2]=> 250 string(1) "f" 251} 252=========================== 253start: 2.5 num: 0 value: 1 254 255Warning: array_fill(): Number of elements must be positive in %s on line %d 256bool(false) 257=========================== 258start: 2.5 num: 0 value: 259 260Warning: array_fill(): Number of elements must be positive in %s on line %d 261bool(false) 262=========================== 263start: 2.5 num: 0 value: 264 265Warning: array_fill(): Number of elements must be positive in %s on line %d 266bool(false) 267=========================== 268start: 2.5 num: 0 value: d 269 270Warning: array_fill(): Number of elements must be positive in %s on line %d 271bool(false) 272=========================== 273start: 2.5 num: 0 value: e 274 275Warning: array_fill(): Number of elements must be positive in %s on line %d 276bool(false) 277=========================== 278start: 2.5 num: 0 value: f 279 280Warning: array_fill(): Number of elements must be positive in %s on line %d 281bool(false) 282=========================== 283start: 2.5 num: 1 value: 1 284array(1) { 285 [2]=> 286 bool(true) 287} 288=========================== 289start: 2.5 num: 1 value: 290array(1) { 291 [2]=> 292 bool(false) 293} 294=========================== 295start: 2.5 num: 1 value: 296array(1) { 297 [2]=> 298 NULL 299} 300=========================== 301start: 2.5 num: 1 value: d 302array(1) { 303 [2]=> 304 string(1) "d" 305} 306=========================== 307start: 2.5 num: 1 value: e 308array(1) { 309 [2]=> 310 string(1) "e" 311} 312=========================== 313start: 2.5 num: 1 value: f 314array(1) { 315 [2]=> 316 string(1) "f" 317} 318=========================== 319start: 2.5 num: 2.5 value: 1 320array(2) { 321 [2]=> 322 bool(true) 323 [3]=> 324 bool(true) 325} 326=========================== 327start: 2.5 num: 2.5 value: 328array(2) { 329 [2]=> 330 bool(false) 331 [3]=> 332 bool(false) 333} 334=========================== 335start: 2.5 num: 2.5 value: 336array(2) { 337 [2]=> 338 NULL 339 [3]=> 340 NULL 341} 342=========================== 343start: 2.5 num: 2.5 value: d 344array(2) { 345 [2]=> 346 string(1) "d" 347 [3]=> 348 string(1) "d" 349} 350=========================== 351start: 2.5 num: 2.5 value: e 352array(2) { 353 [2]=> 354 string(1) "e" 355 [3]=> 356 string(1) "e" 357} 358=========================== 359start: 2.5 num: 2.5 value: f 360array(2) { 361 [2]=> 362 string(1) "f" 363 [3]=> 364 string(1) "f" 365} 366== Done =================Done==================== 367