3v4l.org

run code in 300+ PHP versions simultaneously
<?php $lists = [ ['A', 'B', 'C', 'D', 'E'], ['A', 'B', 'C', 'D'], ['A', 'B', 'C', 'D', 'E', 'F'], ]; foreach ($lists as &$row) { $newRow = []; foreach ($row as $i => $v) { $newRow['Key' . $i + 1] = $v; } $row = $newRow; } var_export($lists);
Output for git.master, git.master_jit, rfc.property-hooks
array ( 0 => array ( 'Key1' => 'A', 'Key2' => 'B', 'Key3' => 'C', 'Key4' => 'D', 'Key5' => 'E', ), 1 => array ( 'Key1' => 'A', 'Key2' => 'B', 'Key3' => 'C', 'Key4' => 'D', ), 2 => array ( 'Key1' => 'A', 'Key2' => 'B', 'Key3' => 'C', 'Key4' => 'D', 'Key5' => 'E', 'Key6' => 'F', ), )

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:
63.31 ms | 406 KiB | 5 Q