3v4l.org

run code in 500+ PHP versions simultaneously
<?php $arr = [ [ 'foo 1', 'bar 1', '', '', 'test 1', 'lorem 1', 'ipsum 1', '', 'will be ignored 1', ], [ 'foo 2', 'bar 2', '', '', 'test 2', 'lorem 2', 'ipsum 2', '', 'will be ignored 2', ], [ 'foo 3', 'bar 3', '', '', 'test 3', 'lorem 3', 'ipsum 3', '', 'will be ignored 3', ], [ 'foo 4', 'bar 4', '', '', 'test 4', 'lorem 4', 'ipsum 4', '', 'will be ignored 4', ], ]; $newArray = []; foreach($arr as $sub) { // The example array you say you want have 8 elements, indexes 0-7 $newArray[] = array_slice($sub, 0, 8); } print_r($newArray);
Output for rfc.property-hooks, git.master, git.master_jit
Array ( [0] => Array ( [0] => foo 1 [1] => bar 1 [2] => [3] => [4] => test 1 [5] => lorem 1 [6] => ipsum 1 [7] => ) [1] => Array ( [0] => foo 2 [1] => bar 2 [2] => [3] => [4] => test 2 [5] => lorem 2 [6] => ipsum 2 [7] => ) [2] => Array ( [0] => foo 3 [1] => bar 3 [2] => [3] => [4] => test 3 [5] => lorem 3 [6] => ipsum 3 [7] => ) [3] => Array ( [0] => foo 4 [1] => bar 4 [2] => [3] => [4] => test 4 [5] => lorem 4 [6] => ipsum 4 [7] => ) )

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:
55.28 ms | 1446 KiB | 4 Q