3v4l.org

run code in 300+ PHP versions simultaneously
<?php // This code is public domain. The original author is Marc Ermshaus. error_reporting(-1); /** * Circularly shifts an array * * Shifts to right for $steps > 0. Shifts to left for $steps < 0. Keys are * preserved. * * @param array $array Array to shift * @param int $steps Steps to shift array by * @return array Resulting array */ function array_circular(array $array, $steps = 1) { return array_merge(array_slice($array, $steps), array_slice($array, 0, $steps)); } header('content-type: text/plain'); $a = array("1" => "Primeiro", "2"=>"Segundo", "3"=>"Terceiro", "4"=> "Quarto"); $l = sizeof($a); for ($i = 0 ; $i < $l; $i++) { printf("% 3s : %s\n", $i, implode(', ', array_shift_circular($a, $i))); } ?>
Output for git.master, git.master_jit, rfc.property-hooks
Fatal error: Uncaught Error: Call to undefined function array_shift_circular() in /in/7GEHp:32 Stack trace: #0 {main} thrown in /in/7GEHp on line 32
Process exited with code 255.

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:
67.24 ms | 401 KiB | 8 Q