3v4l.org

run code in 300+ PHP versions simultaneously
<?php $a = [1,2,3,4,5]; function array_rotate(&$array, $step = 1) { $length = count($array); end($array); while ($step--) prev($array); while ($length--) { next($array); if (key($array) === null) reset($array); yield current($array); } } print_r(iterator_to_array(array_rotate($a, 2)));

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.4.20.0030.00619.78
8.4.10.0040.01121.19
8.3.150.0090.00917.29
8.3.140.0080.00017.01
8.3.130.0100.00016.81
8.3.120.0160.00318.92
8.3.110.0040.00420.94
8.3.100.0130.00624.06
8.3.90.0060.00326.77
8.3.80.0060.00316.50
8.3.70.0110.00718.31
8.3.60.0110.00718.43
8.3.50.0130.00424.42
8.3.40.0070.00718.79
8.3.30.0160.00018.55
8.3.20.0000.00824.18
8.3.10.0060.00324.66
8.3.00.0090.00026.16
8.2.270.0000.01516.72
8.2.260.0160.00019.04
8.2.250.0030.00516.37
8.2.240.0040.01218.66
8.2.230.0060.00622.58
8.2.220.0030.00637.54
8.2.210.0090.00926.77
8.2.200.0030.00616.50
8.2.190.0110.00716.58
8.2.180.0070.00725.92
8.2.170.0170.00318.78
8.2.160.0070.00722.96
8.2.150.0000.00825.66
8.2.140.0000.00724.66
8.2.130.0000.00726.16
8.2.120.0080.00018.70
8.2.110.0060.00322.01
8.2.100.0110.00017.91
8.2.90.0040.00417.91
8.2.80.0000.00817.97
8.2.70.0040.00418.05
8.2.60.0000.00818.22
8.2.50.0030.00618.10
8.2.40.0030.00619.45
8.2.30.0050.00319.12
8.2.20.0040.00417.97
8.2.10.0060.00419.37
8.2.00.0070.00417.87
8.1.310.0070.00016.75
8.1.300.0040.00418.44
8.1.290.0050.00318.88
8.1.280.0100.01025.92
8.1.270.0060.00323.77
8.1.260.0150.00426.35
8.1.250.0040.00428.09
8.1.240.0100.00317.25
8.1.230.0120.00020.93
8.1.220.0050.00517.74
8.1.210.0090.00018.77
8.1.200.0030.00617.35
8.1.190.0050.00317.25
8.1.180.0040.00418.10
8.1.170.0000.00818.59
8.1.160.0040.00419.01
8.1.150.0040.00418.84
8.1.140.0060.00219.96
8.1.130.0040.00817.45
8.1.120.0070.00617.51
8.1.110.0040.01017.46
8.1.100.0080.00617.49
8.1.90.0050.00817.47
8.1.80.0100.00517.44
8.1.70.0070.00717.39
8.1.60.0070.00917.50
8.1.50.0100.00617.54
8.1.40.0130.00317.54
8.1.30.0090.00817.54
8.1.20.0120.00417.65
8.1.10.0110.00417.47
8.1.00.0090.00517.48
8.0.300.0040.00419.66
8.0.290.0070.00316.63
8.0.280.0030.00318.55
8.0.270.0100.00316.73
8.0.260.0100.00316.83
8.0.250.0090.00416.92
8.0.240.0080.00516.93
8.0.230.0040.00616.92
8.0.220.0030.00916.88
8.0.210.0060.00616.83
8.0.200.0090.00216.91
8.0.190.0090.00216.93
8.0.180.0070.00616.92
8.0.170.0080.00516.85
8.0.160.0060.00416.84
8.0.150.0060.00616.84
8.0.140.0060.00516.82
8.0.130.0060.00315.69
8.0.120.0080.00416.81
8.0.110.0090.00316.87
8.0.100.0090.00416.82
8.0.90.0120.00216.90
8.0.80.0100.00716.94
8.0.70.0090.00416.88
8.0.60.0050.00716.83
8.0.50.0090.00416.86
8.0.30.0090.00716.93
8.0.20.0090.00817.07
8.0.10.0060.00616.96
8.0.00.0120.00316.86
7.4.330.0080.00316.27
7.4.320.0080.00616.60
7.4.300.0080.00616.60
7.4.290.0100.00316.62
7.4.280.0110.00416.70
7.4.270.0100.00516.67
7.4.260.0090.00415.52
7.4.250.0070.00616.63
7.4.240.0110.00216.64
7.4.230.0030.01016.59
7.4.220.0060.00516.59
7.4.210.0080.00716.58
7.4.200.0080.00416.55
7.4.190.0110.00416.80
7.4.180.0080.00516.67
7.4.160.0100.00516.73
7.4.150.0090.00616.76
7.4.140.0130.00116.63
7.4.130.0130.00416.55
7.4.120.0110.00416.61
7.4.110.0150.00216.60
7.4.100.0090.00816.68
7.4.90.0120.00316.60
7.4.80.0060.00916.61
7.4.70.0120.00416.61
7.4.60.0110.00516.63
7.4.50.0130.00516.55
7.4.40.0130.00516.58
7.4.30.0100.00716.54
7.4.20.0100.00516.66
7.4.10.0090.00916.57
7.4.00.0080.00916.64
7.3.330.0090.00416.53
7.3.320.0080.00315.52
7.3.310.0100.00216.52
7.3.300.0060.00616.53
7.3.290.0110.00416.39
7.3.280.0090.00516.51
7.3.270.0090.00616.63
7.3.260.0090.00816.55
7.3.250.0120.00316.63
7.3.240.0140.00116.63
7.3.230.0100.00516.55
7.3.220.0090.00616.63
7.3.210.0110.00516.57
7.3.200.0080.00816.59
7.3.190.0120.00516.52
7.3.180.0110.00716.51
7.3.170.0110.00616.56
7.3.160.0160.00216.52
7.3.150.0100.00616.52
7.3.140.0110.00516.51
7.3.130.0070.01116.61
7.3.120.0080.00916.50
7.3.110.0100.00816.53
7.3.100.0110.00716.47
7.3.90.0110.00616.67
7.3.80.0110.00616.55
7.3.70.0090.01016.56
7.3.60.0100.00816.52
7.3.50.0110.00716.49
7.3.40.0140.00416.57
7.3.30.0140.00216.58
7.3.20.0130.00417.15
7.3.10.0140.00517.13
7.3.00.0060.01117.15
7.2.340.0140.00216.63
7.2.330.0120.00416.73
7.2.320.0110.00616.58
7.2.310.0130.00516.69
7.2.300.0130.00516.58
7.2.290.0120.00416.54
7.2.280.0110.00416.57
7.2.270.0070.01016.65
7.2.260.0120.00516.66
7.2.250.0100.00916.68
7.2.240.0090.01016.65
7.2.230.0110.00616.67
7.2.220.0120.00616.68
7.2.210.0120.00516.61
7.2.200.0100.00816.74
7.2.190.0110.00716.67
7.2.180.0110.00816.68
7.2.170.0130.00316.72
7.2.160.0040.01116.62
7.2.150.0130.00417.26
7.2.140.0090.00917.23
7.2.130.0110.00617.36
7.2.120.0120.00517.38
7.2.110.0100.00817.27
7.2.100.0140.00517.23
7.2.90.0100.00817.27
7.2.80.0100.00717.20
7.2.70.0100.00817.36
7.2.60.0130.00517.39
7.2.50.0140.00417.27
7.2.40.0120.00617.34
7.2.30.0080.00917.37
7.2.20.0070.00917.38
7.2.10.0120.00517.35
7.2.00.0120.00717.25

preferences:
28.62 ms | 403 KiB | 5 Q