3v4l.org

run code in 300+ PHP versions simultaneously
<?php function popUnshift(array $indexedArray, int $popShiftsCount): array { $count = count($indexedArray); if ($count < 2) { return $indexedArray; } $remainder = $popShiftsCount % $count; if (!$remainder) { return $indexedArray; } return array_merge( array_splice($indexedArray, -$remainder), $indexedArray ); } $A = [1, 2, 3, 4]; foreach (range(0, 9) as $K) { var_export(popUnshift($A, $K)); echo "\n---\n"; }

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.0210.00016.32
8.3.50.0080.00820.36
8.3.40.0150.00020.29
8.3.30.0110.00418.71
8.3.20.0000.00824.18
8.3.10.0080.00024.66
8.3.00.0000.00826.16
8.2.180.0100.00725.92
8.2.170.0090.00619.09
8.2.160.0180.00322.96
8.2.150.0070.00025.66
8.2.140.0040.00424.66
8.2.130.0070.00026.16
8.2.120.0060.00321.04
8.2.110.0040.00420.34
8.2.100.0040.00717.53
8.2.90.0040.00417.90
8.2.80.0040.00817.97
8.2.70.0060.00317.63
8.2.60.0030.00717.63
8.2.50.0050.00317.75
8.2.40.0040.00418.22
8.2.30.0000.00818.07
8.2.20.0000.00720.42
8.2.10.0050.00218.13
8.2.00.0040.00419.23
8.1.280.0070.00725.92
8.1.270.0030.00623.87
8.1.260.0080.00026.35
8.1.250.0040.00428.09
8.1.240.0070.00423.92
8.1.230.0040.00723.93
8.1.220.0040.00417.77
8.1.210.0000.00818.92
8.1.200.0060.00317.35
8.1.190.0000.00918.76
8.1.180.0000.00818.10
8.1.170.0050.00317.62
8.1.160.0040.00418.93
8.1.150.0070.00018.68
8.1.140.0030.00517.45
8.1.130.0020.00517.37
8.1.120.0070.00017.45
8.1.110.0000.00717.45
8.1.100.0000.00817.39
8.1.90.0030.00417.46
8.1.80.0040.00417.48
8.1.70.0140.00317.36
8.1.60.0150.00317.41
8.1.50.0110.00817.37
8.1.40.0150.00317.53
8.1.30.0090.00917.66
8.1.20.0190.00017.63
8.1.10.0180.00017.59
8.1.00.0130.00517.46
8.0.300.0070.00019.98
8.0.290.0000.00716.75
8.0.280.0000.00818.42
8.0.270.0040.00416.83
8.0.260.0000.00716.84
8.0.250.0030.00517.05
8.0.240.0030.00316.96
8.0.230.0050.00316.91
8.0.220.0040.00416.88
8.0.210.0070.00016.88
8.0.200.0110.00516.86
8.0.190.0100.00516.74
8.0.180.0150.00016.82
8.0.170.0150.00016.88
8.0.160.0160.00316.94
8.0.150.0120.00516.80
8.0.140.0140.00316.86
8.0.130.0130.00516.70
8.0.120.0130.00316.86
8.0.110.0080.00816.91
8.0.100.0100.00516.92
8.0.90.0090.00616.93
8.0.80.0100.00516.72
8.0.70.0130.00316.74
8.0.60.0120.00416.89
8.0.50.0110.00416.89
8.0.30.0100.00516.74
8.0.20.0130.00316.96
8.0.10.0080.00816.99
7.4.330.0000.00415.55
7.4.320.0030.00516.62
7.4.300.0100.00716.52
7.4.290.0130.00316.54
7.4.280.0080.00816.61
7.4.270.0080.00916.50
7.4.260.0140.00316.39
7.4.250.0090.00916.36
7.4.240.0100.00716.61
7.4.230.0170.00316.42
7.4.220.0100.00716.59
7.4.210.0120.00416.56
7.4.200.0100.00616.41
7.4.190.0050.01016.64
7.4.180.0080.00816.53
7.4.160.0130.00416.52
7.4.150.0100.00516.40
7.4.140.0130.00316.40
7.4.130.0090.00816.37
7.4.120.0070.00716.44
7.4.110.0110.00616.46
7.4.100.0140.00316.56
7.4.90.0090.00516.54
7.4.80.0100.00716.45
7.4.70.0100.00516.50
7.4.60.0160.00016.34
7.4.50.0100.00616.28
7.4.40.0080.00816.40
7.4.30.0120.00416.34
7.4.20.0140.00216.32
7.4.10.0130.00316.37
7.4.00.0120.00516.51

preferences:
62.85 ms | 400 KiB | 5 Q