@ 2015-12-08T22:06:13Z <?php
// Create an array with 0 value
$array = array(0);
// Iterate over the array, var_dump each value
// At the same time, set the next value to "lolcats"
foreach ($array as $key => &$val) {
var_dump($val);
if($key < 10) {
$array[++$key] = "lolcats";
}
}
// Finally var_dump the $array
var_dump($array);
Enable javascript to submit You have javascript disabled. You will not be able to edit any code.
Output for 7.0.0 - 7.0.33 , 7.1.0 - 7.1.33 , 7.2.0 - 7.2.33 , 7.3.0 - 7.3.33 , 7.4.0 - 7.4.33 , 8.0.0 - 8.0.30 , 8.1.0 - 8.1.28 , 8.2.0 - 8.2.18 , 8.3.0 - 8.3.6 int(0)
string(7) "lolcats"
string(7) "lolcats"
string(7) "lolcats"
string(7) "lolcats"
string(7) "lolcats"
string(7) "lolcats"
string(7) "lolcats"
string(7) "lolcats"
string(7) "lolcats"
string(7) "lolcats"
array(11) {
[0]=>
int(0)
[1]=>
string(7) "lolcats"
[2]=>
string(7) "lolcats"
[3]=>
string(7) "lolcats"
[4]=>
string(7) "lolcats"
[5]=>
string(7) "lolcats"
[6]=>
string(7) "lolcats"
[7]=>
string(7) "lolcats"
[8]=>
string(7) "lolcats"
[9]=>
string(7) "lolcats"
[10]=>
&string(7) "lolcats"
}
Output for 5.5.0 - 5.5.38 , 5.6.0 - 5.6.40 int(0)
array(2) {
[0]=>
&int(0)
[1]=>
string(7) "lolcats"
}
preferences:dark mode live preview
282.21 ms | 402 KiB | 327 Q