3v4l.org

run code in 300+ PHP versions simultaneously
<?php function skipFromBack(array $array, int $skip): array { $result = []; for ($index = array_key_last($array); $index > -1; $index -= 1 + $skip) { $result[] = $array[$index]; } return array_reverse($result); } $array = range(0, 15); foreach ([0, 1, 2, 3] as $skip) { var_export(skipFromBack($array, $skip)); echo "\n---\n"; }
Output for git.master, git.master_jit, rfc.property-hooks
array ( 0 => 0, 1 => 1, 2 => 2, 3 => 3, 4 => 4, 5 => 5, 6 => 6, 7 => 7, 8 => 8, 9 => 9, 10 => 10, 11 => 11, 12 => 12, 13 => 13, 14 => 14, 15 => 15, ) --- array ( 0 => 1, 1 => 3, 2 => 5, 3 => 7, 4 => 9, 5 => 11, 6 => 13, 7 => 15, ) --- array ( 0 => 0, 1 => 3, 2 => 6, 3 => 9, 4 => 12, 5 => 15, ) --- array ( 0 => 3, 1 => 7, 2 => 11, 3 => 15, ) ---

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