3v4l.org

run code in 300+ PHP versions simultaneously
<?php $a = array(array(0),array(1),array(2),array(3),array(4)); foreach ($a as $k => $v) { echo $k .' => ' . json_encode($v) . PHP_EOL; $i = 0; // for ($i = 0; $i < 2; $i++) { $new = $v; $new[] = $i; array_push($a, $new); // } echo $k .' => ' . json_encode($v) . PHP_EOL; } var_dump($a);
Output for git.master, git.master_jit, rfc.property-hooks
0 => [0] 0 => [0] 1 => [1] 1 => [1] 2 => [2] 2 => [2] 3 => [3] 3 => [3] 4 => [4] 4 => [4] array(10) { [0]=> array(1) { [0]=> int(0) } [1]=> array(1) { [0]=> int(1) } [2]=> array(1) { [0]=> int(2) } [3]=> array(1) { [0]=> int(3) } [4]=> array(1) { [0]=> int(4) } [5]=> array(2) { [0]=> int(0) [1]=> int(0) } [6]=> array(2) { [0]=> int(1) [1]=> int(0) } [7]=> array(2) { [0]=> int(2) [1]=> int(0) } [8]=> array(2) { [0]=> int(3) [1]=> int(0) } [9]=> array(2) { [0]=> int(4) [1]=> int(0) } }

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
49.74 ms | 402 KiB | 8 Q