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) { if ($steps === 0) { return $array; } $l = count($array); if ($l === 0) { return $array; } $steps = $steps % $l; $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 = len($a); for ($i = 0 ; $i < $l; $i++) { printf("% 3s : %s\n", $i, implode(', ', array_shift_circular($a, $i))); } ?>

Here you find the average performance (time & memory) of each version. A grayed out version indicates it didn't complete successfully (based on exit-code).

VersionSystem time (s)User time (s)Memory (MiB)
8.3.60.0170.00718.43
8.3.50.0130.00717.95
8.3.40.0120.00318.58
8.3.30.0110.00418.70
8.3.20.0030.00619.15
8.3.10.0040.00419.43
8.3.00.0000.00823.70
8.2.180.0110.00318.29
8.2.170.0040.01122.96
8.2.160.0140.00022.08
8.2.150.0040.00424.18
8.2.140.0040.00424.66
8.2.130.0040.00419.72
8.2.120.0040.00426.35
8.2.110.0000.01021.05
8.2.100.0040.00717.78
8.2.90.0060.00317.91
8.2.80.0080.00418.03
8.2.70.0050.00517.79
8.2.60.0100.00018.09
8.2.50.0030.00618.10
8.2.40.0000.00819.17
8.2.30.0040.00419.38
8.2.20.0000.00818.10
8.2.10.0030.00519.91
8.2.00.0040.00419.50
8.1.280.0120.00325.92
8.1.270.0000.00723.79
8.1.260.0080.00026.35
8.1.250.0050.00328.09
8.1.240.0090.00022.17
8.1.230.0040.00720.97
8.1.220.0060.00317.74
8.1.210.0100.00018.77
8.1.200.0030.00617.00
8.1.190.0080.00017.23
8.1.180.0000.00918.10
8.1.170.0060.00318.59
8.1.160.0040.00418.93
8.1.150.0030.00518.86
8.1.140.0000.00717.63
8.1.130.0000.00719.00
8.1.120.0000.00717.43
8.1.110.0000.01017.37
8.1.100.0030.00317.37
8.1.90.0020.00517.37
8.1.80.0000.00817.41
8.1.70.0030.00317.36
8.1.60.0050.00217.50
8.1.50.0030.00517.45
8.1.40.0000.00817.52
8.1.30.0000.00817.62
8.1.20.0000.00717.57
8.1.10.0000.01117.64
8.1.00.0000.00817.53
8.0.300.0040.00419.84
8.0.290.0040.00416.75
8.0.280.0070.00018.36
8.0.270.0000.00717.19
8.0.260.0080.00017.21
8.0.250.0000.00716.85
8.0.240.0030.00316.93
8.0.230.0000.00716.84
8.0.220.0000.00716.88
8.0.210.0040.00316.88
8.0.200.0040.00416.83
8.0.190.0040.00416.95
8.0.180.0000.00816.91
8.0.170.0060.00316.79
8.0.160.0040.00417.01
8.0.150.0040.00416.90
8.0.140.0000.00716.80
8.0.130.0000.00513.27
8.0.120.0000.00716.76
8.0.110.0050.00216.87
8.0.100.0040.00416.71
8.0.90.0040.00416.92
8.0.80.0030.01616.85
8.0.70.0040.00416.70
8.0.60.0000.00716.66
8.0.50.0000.00716.77
8.0.30.0120.00817.16
8.0.20.0150.00317.40
8.0.10.0000.00816.86
8.0.00.0170.01916.78
7.4.330.0000.00515.55
7.4.320.0030.00316.57
7.4.300.0030.00316.35
7.4.290.0000.00716.50
7.4.280.0000.00716.58
7.4.270.0040.00416.59
7.4.260.0020.00516.57
7.4.250.0070.00016.51
7.4.240.0070.00016.52
7.4.230.0030.00316.39
7.4.220.0040.00416.61
7.4.210.0090.01016.56
7.4.200.0040.00416.63
7.4.160.0140.00416.58
7.4.140.0120.00817.86
7.4.130.0280.00016.52
7.4.120.0110.00816.61
7.4.110.0140.00416.47
7.4.100.0130.00316.43
7.4.90.0150.00416.51
7.4.80.0080.01219.39
7.4.70.0090.01116.53
7.4.60.0150.00616.53
7.4.50.0030.01016.32
7.4.40.0130.01016.45
7.4.00.0000.01814.84
7.3.330.0000.00513.29
7.3.320.0000.00613.36
7.3.310.0000.00716.14
7.3.300.0070.00016.16
7.3.290.0040.00416.29
7.3.280.0050.01016.33
7.3.260.0090.01016.43
7.3.240.0090.00816.35
7.3.230.0070.01116.30
7.3.210.0080.00816.49
7.3.200.0060.00916.20
7.3.190.0080.01116.43
7.3.180.0150.00016.23
7.3.170.0060.01616.45
7.3.160.0100.00716.32
7.2.330.0170.00016.66
7.2.320.0120.00616.34
7.2.310.0070.01016.38
7.2.300.0140.00316.45
7.2.290.0040.01516.37
7.2.60.1360.01014.89
7.2.50.1300.00414.94
7.2.40.1150.00915.43
7.2.30.1030.00715.43
7.2.20.0860.00815.21
7.2.10.0840.01115.22
7.2.00.1030.00715.32
7.1.200.0080.00015.70
7.1.170.1120.00613.58
7.1.160.0900.00816.86
7.1.150.0840.01216.75
7.1.140.0860.01016.59
7.1.130.0870.00916.81
7.1.120.1950.00616.54
7.1.110.0930.00716.04
7.1.100.0950.00916.36
7.1.90.1210.00815.93
7.1.80.1140.01116.04
7.1.70.1410.00615.40
7.1.60.1260.01433.15
7.1.50.0260.01232.85
7.1.40.1300.01532.27
7.1.30.0860.01832.66
7.1.20.0940.01732.67
7.1.10.0350.01014.67
7.1.00.1130.00814.61

preferences:
57.32 ms | 401 KiB | 5 Q