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 = count($a); for ($i = $l * -2; $i <= $l * 2; $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.70.0090.00616.62
8.3.60.0100.00718.55
8.3.50.0070.00718.29
8.3.40.0090.00918.84
8.3.30.0140.00018.80
8.3.20.0080.00019.02
8.3.10.0030.00619.04
8.3.00.0080.00023.56
8.2.190.0150.00316.58
8.2.180.0040.01418.43
8.2.170.0040.01122.96
8.2.160.0070.00722.16
8.2.150.0090.00024.18
8.2.140.0000.00824.66
8.2.130.0080.00019.82
8.2.120.0080.00026.35
8.2.110.0000.01019.61
8.2.100.0090.00317.72
8.2.90.0030.00617.88
8.2.80.0000.00818.86
8.2.70.0000.00817.93
8.2.60.0040.00418.03
8.2.50.0000.00818.10
8.2.40.0060.00319.43
8.2.30.0000.00719.43
8.2.20.0040.00417.98
8.2.10.0080.00018.10
8.2.00.0070.00019.48
8.1.280.0070.00725.92
8.1.270.0070.00023.91
8.1.260.0000.00826.35
8.1.250.0080.00028.09
8.1.240.0030.00623.96
8.1.230.0080.00320.97
8.1.220.0030.00517.74
8.1.210.0030.00618.77
8.1.200.0080.00017.36
8.1.190.0060.00317.35
8.1.180.0050.00318.10
8.1.170.0040.00418.65
8.1.160.0040.00418.88
8.1.150.0040.00418.80
8.1.140.0050.00217.57
8.1.130.0000.00719.01
8.1.120.0040.00417.48
8.1.110.0060.00317.48
8.1.100.0050.00317.43
8.1.90.0050.00217.41
8.1.80.0000.00717.34
8.1.70.0030.00317.42
8.1.60.0000.00917.49
8.1.50.0040.00417.44
8.1.40.0050.00317.54
8.1.30.0050.00317.66
8.1.20.0030.00517.62
8.1.10.0000.00817.62
8.1.00.0040.00417.55
8.0.300.0070.00018.98
8.0.290.0000.00816.63
8.0.280.0070.00018.37
8.0.270.0050.00317.21
8.0.260.0000.00617.16
8.0.250.0030.00417.07
8.0.240.0070.00016.92
8.0.230.0000.00816.95
8.0.220.0040.00416.93
8.0.210.0030.00316.88
8.0.200.0030.00316.97
8.0.190.0040.00416.88
8.0.180.0050.00316.80
8.0.170.0000.00916.97
8.0.160.0050.00316.88
8.0.150.0030.00616.78
8.0.140.0000.00716.82
8.0.130.0000.00513.38
8.0.120.0040.00416.92
8.0.110.0000.00816.83
8.0.100.0040.00416.95
8.0.90.0000.00716.99
8.0.80.0110.00716.89
8.0.70.0040.00417.01
8.0.60.0000.00716.93
8.0.50.0050.00316.99
8.0.30.0100.00817.09
8.0.20.0170.00517.40
8.0.10.0040.00417.14
8.0.00.0100.00816.66
7.4.330.0000.00515.55
7.4.320.0020.00516.43
7.4.300.0000.00616.64
7.4.290.0040.00416.50
7.4.280.0040.00416.59
7.4.270.0070.00016.59
7.4.260.0030.00316.58
7.4.250.0070.00016.45
7.4.240.0040.00416.61
7.4.230.0040.00416.60
7.4.220.0030.00516.48
7.4.210.0120.00416.59
7.4.200.0070.00016.61
7.4.160.0100.00516.46
7.4.140.0100.01017.86
7.4.130.0140.00316.40
7.4.120.0120.00616.58
7.4.110.0030.01316.54
7.4.100.0000.01616.71
7.4.90.0140.00716.28
7.4.80.0110.00719.39
7.4.70.0030.01516.65
7.4.60.0030.01316.43
7.4.50.0070.00716.25
7.4.40.0110.01116.48
7.4.00.0100.00715.06
7.3.330.0000.00613.21
7.3.320.0030.00313.37
7.3.310.0070.00016.20
7.3.300.0000.00616.37
7.3.290.0070.00016.27
7.3.280.0060.00916.35
7.3.260.0140.01816.57
7.3.240.0100.00616.49
7.3.230.0130.00316.63
7.3.210.0090.00916.39
7.3.200.0080.00816.64
7.3.190.0070.01016.44
7.3.180.0110.00416.48
7.3.170.0060.01616.47
7.3.160.0030.01316.38
7.3.120.0060.00914.94
7.3.110.0080.00614.72
7.3.100.0040.01114.46
7.3.90.0030.00914.86
7.3.80.0000.01414.44
7.3.70.0070.01014.60
7.3.60.0080.00814.66
7.3.50.0030.01314.68
7.3.40.0050.00514.64
7.3.30.0030.01014.82
7.3.20.0070.00716.69
7.3.10.0030.01016.52
7.3.00.0070.00716.55
7.2.330.0120.00616.67
7.2.320.0070.01016.70
7.2.310.0110.00616.79
7.2.300.0100.01116.85
7.2.290.0090.00916.73
7.2.240.0060.00614.94
7.2.230.0060.01015.29
7.2.220.0070.00714.87
7.2.210.0130.00014.86
7.2.200.0000.01414.93
7.2.190.0040.01114.96
7.2.180.0040.01414.77
7.2.170.0000.01514.89
7.2.160.0070.00714.85
7.2.150.0030.00916.64
7.2.140.0060.00816.79
7.2.130.0110.00717.07
7.2.120.0070.00416.89
7.2.110.0070.00716.52
7.2.100.0060.01016.68
7.2.90.0000.01816.62
7.2.80.0070.01116.80
7.2.70.0040.01116.71
7.2.60.0690.00815.92
7.2.50.0680.01015.90
7.2.40.0480.00516.25
7.2.30.0440.00716.30
7.2.20.0440.00616.17
7.2.10.0950.00716.32
7.2.00.0380.00716.04
7.1.330.0130.00015.79
7.1.320.0070.01015.78
7.1.310.0050.01415.45
7.1.300.0040.01115.60
7.1.290.0030.00715.82
7.1.280.0030.01315.70
7.1.270.0060.00915.51
7.1.260.0070.00615.83
7.1.250.0060.00915.79
7.1.200.0060.00015.95
7.1.170.0860.00713.86
7.1.160.0790.00817.00
7.1.150.0870.00917.07
7.1.140.1170.01516.87
7.1.130.0720.00616.52
7.1.120.0700.00916.73
7.1.110.0770.00715.99
7.1.100.0880.00816.36
7.1.90.1170.01116.01
7.1.80.1340.01316.13
7.1.70.1070.01015.42
7.1.60.1410.01133.18
7.1.50.1260.01332.82
7.1.40.1250.01132.56
7.1.30.1250.01832.81
7.1.20.1300.01632.71
7.1.10.1410.01114.83
7.1.00.1610.01814.63

preferences:
59.89 ms | 401 KiB | 5 Q