3v4l.org

run code in 300+ PHP versions simultaneously
<?php $numbers = [1.2549999999, 1.28012, 2.01212, 4.012, 5.0000012, 5.012121001, -0.12]; $boundaries = [1.26, 2.46, 5.01]; function checkRange(float $number, array $boundaries): int { if ($number < 0) { return -1; } foreach ($boundaries as $i => $boundary) { if ($number < $boundary) { return $i + 1; break; } } return 4; } foreach ($numbers as $number) { echo "$number at Range ", checkRange($number, $boundaries), "\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.0090.01216.63
8.3.50.0110.00418.30
8.3.40.0160.00020.52
8.3.30.0160.00319.23
8.3.20.0090.00924.18
8.3.10.0050.00324.66
8.3.00.0080.00026.16
8.2.180.0160.00325.92
8.2.170.0030.01718.91
8.2.160.0030.01022.96
8.2.150.0000.00725.66
8.2.140.0110.00324.66
8.2.130.0040.00426.16
8.2.120.0040.00426.16
8.2.110.0000.00922.25
8.2.100.0040.00819.45
8.2.90.0040.00417.63
8.2.80.0080.00018.78
8.2.70.0080.00017.75
8.2.60.0000.00818.03
8.2.50.0060.00318.07
8.2.40.0040.00418.17
8.2.30.0040.00418.13
8.2.20.0040.00420.44
8.2.10.0000.00718.12
8.2.00.0050.00219.18
8.1.280.0110.00725.92
8.1.270.0070.00723.83
8.1.260.0040.00426.35
8.1.250.0040.00428.09
8.1.240.0000.00818.99
8.1.230.0040.00817.64
8.1.220.0000.00917.76
8.1.210.0030.00518.77
8.1.200.0000.00917.13
8.1.190.0030.00517.13
8.1.180.0000.00818.10
8.1.170.0080.00018.85
8.1.160.0050.00218.90
8.1.150.0000.00718.68
8.1.140.0040.00417.47
8.1.130.0000.00718.80
8.1.120.0000.00717.49
8.1.110.0080.00017.50
8.1.100.0000.00817.36
8.1.90.0000.00817.34
8.1.80.0060.00617.34
8.1.70.0070.00517.46
8.1.60.0100.00317.49
8.1.50.0100.00317.52
8.1.40.0080.00817.48
8.1.30.0140.00217.49
8.1.20.0140.00417.52
8.1.10.0110.00517.45
8.1.00.0100.00717.39
8.0.300.0080.00018.77
8.0.290.0000.00816.75
8.0.280.0000.00818.32
8.0.270.0040.00316.88
8.0.260.0000.00718.32
8.0.250.0070.00016.89
8.0.240.0000.00716.79
8.0.230.0000.00816.98
8.0.220.0030.00616.89
8.0.210.0100.00216.89
8.0.200.0060.00616.82
8.0.190.0060.00516.94
8.0.180.0060.00616.92
8.0.170.0100.00316.80
8.0.160.0110.00316.87
8.0.150.0150.00216.77
8.0.140.0130.00416.78
8.0.130.0120.00616.81
8.0.120.0140.00416.85
8.0.110.0150.00316.87
8.0.100.0110.00816.82
8.0.90.0120.00616.79
8.0.80.0110.00516.87
8.0.70.0070.01116.81
8.0.60.0150.00416.86
8.0.50.0130.00516.85
8.0.30.0130.00516.82
8.0.20.0140.00316.91
8.0.10.0110.00417.04
7.4.330.0000.00515.55
7.4.320.0000.00616.55
7.4.300.0120.00016.57
7.4.290.0080.00416.53
7.4.280.0130.00416.51
7.4.270.0170.00416.57
7.4.260.0130.00616.52
7.4.250.0110.00616.50
7.4.240.0090.00716.37
7.4.230.0100.00516.46
7.4.220.0100.00616.49
7.4.210.0100.00816.53
7.4.200.0120.00316.40
7.4.190.0100.00616.55
7.4.180.0140.00416.49
7.4.160.0090.00916.56
7.4.150.0160.00216.49
7.4.140.0180.00316.41
7.4.130.0140.00416.45
7.4.120.0120.00516.39
7.4.110.0130.00516.32
7.4.100.0130.00516.52
7.4.90.0150.00316.46
7.4.80.0120.00716.49
7.4.70.0170.00116.38
7.4.60.0140.00016.39
7.4.50.0150.00316.33
7.4.40.0120.00616.41
7.4.30.0160.00416.51
7.4.20.0130.00516.41
7.4.10.0120.00516.38
7.4.00.0120.00416.43

preferences:
49.13 ms | 401 KiB | 5 Q