3v4l.org

run code in 300+ PHP versions simultaneously
<?php function sample(int $val, int $min, int $max) { $listLength = $max - $min + 1; $key = ($val % $listLength) % $listLength; if ($key < 0) { $key = $listLength + ($key % $listLength); } return $min + $key; } // ?????? foreach (range(-10, 5) as $i) echo $i .'='. sample($i, 3, 8) . PHP_EOL;

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.0030.01318.43
8.3.50.0130.00318.16
8.3.40.0100.00318.67
8.3.30.0100.00718.54
8.3.20.0080.00019.20
8.3.10.0030.00521.89
8.3.00.0040.00420.71
8.2.180.0140.00018.18
8.2.170.0090.00622.96
8.2.160.0030.01222.08
8.2.150.0050.00324.18
8.2.140.0040.00424.66
8.2.130.0040.00419.77
8.2.120.0040.00426.35
8.2.110.0140.00720.51
8.2.100.0000.01118.22
8.2.90.0000.00817.63
8.2.80.0070.00018.96
8.2.70.0000.00817.80
8.2.60.0040.00418.03
8.2.50.0030.00518.10
8.2.40.0040.00419.25
8.2.30.0040.00419.18
8.2.20.0000.00918.13
8.2.10.0030.00618.09
8.2.00.0030.00617.67
8.1.280.0130.00625.92
8.1.270.0000.00820.56
8.1.260.0050.00326.35
8.1.250.0080.00028.09
8.1.240.0070.00420.49
8.1.230.0070.00418.95
8.1.220.0040.00417.74
8.1.210.0030.00618.77
8.1.200.0060.00317.35
8.1.190.0040.00417.23
8.1.180.0000.00818.10
8.1.170.0000.00818.50
8.1.160.0040.00418.90
8.1.150.0000.00718.77
8.1.140.0030.00322.03
8.1.130.0070.00020.30
8.1.120.0040.00417.41
8.1.110.0000.00717.43
8.1.100.0030.00517.40
8.1.90.0070.00017.46
8.1.80.0020.00517.43
8.1.70.0070.00017.47
8.1.60.0030.00617.43
8.1.50.0040.00417.48
8.1.40.0040.00417.44
8.1.30.0000.00917.66
8.1.20.0050.00317.66
8.1.10.0080.00017.43
8.1.00.0040.00417.46
8.0.300.0050.00218.77
8.0.290.0060.00316.75
8.0.280.0070.00018.45
8.0.270.0040.00417.27
8.0.260.0000.00618.42
8.0.250.0000.00716.84
8.0.240.0000.00717.00
8.0.230.0030.00316.83
8.0.220.0070.00016.83
8.0.210.0090.00016.90
8.0.200.0040.00416.91
8.0.190.0040.00416.96
8.0.180.0040.00416.84
8.0.170.0000.00916.92
8.0.160.0000.00716.92
8.0.150.0000.00716.79
8.0.140.0070.00016.86
8.0.130.0000.00513.27
8.0.120.0000.00716.90
8.0.110.0000.00716.95
8.0.100.0050.00216.90
8.0.90.0050.00316.95
8.0.80.0050.01116.94
8.0.70.0000.00716.73
8.0.60.0030.00316.78
8.0.50.0070.00016.76
8.0.30.0090.00916.91
8.0.20.0100.00917.40
8.0.10.0040.00416.93
8.0.00.0060.01216.72
7.4.330.0020.00215.55
7.4.320.0030.00316.62
7.4.300.0000.00616.51
7.4.290.0000.00716.51
7.4.280.0060.00316.50
7.4.270.0000.00716.52
7.4.260.0030.00616.49
7.4.250.0000.00716.43
7.4.240.0040.00416.64
7.4.230.0040.00416.40
7.4.220.0000.00916.59
7.4.210.0060.00716.64
7.4.200.0070.00016.35
7.4.160.0100.00716.49
7.4.140.0120.00617.86
7.4.130.0090.00916.50
7.4.120.0090.01016.53
7.4.110.0040.01616.49
7.4.100.0130.01016.51
7.4.90.0160.00616.45
7.4.80.0070.01319.39
7.4.70.0060.01116.72
7.4.60.0080.00816.76
7.4.50.0070.01116.35
7.4.40.0090.00916.65
7.4.00.0060.00915.14
7.3.330.0000.00513.32
7.3.320.0030.00313.14
7.3.310.0030.00616.33
7.3.300.0030.00316.16
7.3.290.0040.00416.38
7.3.280.0060.01016.24
7.3.260.0150.00716.53
7.3.240.0080.00916.47
7.3.230.0090.01216.36
7.3.210.0110.00516.53
7.3.200.0060.01016.68
7.3.190.0090.01016.33
7.3.180.0080.00916.56
7.3.170.0110.00816.67
7.3.160.0120.00316.50
7.2.330.0180.00016.77
7.2.320.0210.00316.49
7.2.310.0000.01716.75
7.2.300.0170.00016.68
7.2.290.0140.00316.40
7.2.110.0740.00314.87
7.2.100.0840.00714.51
7.2.90.0800.01314.45
7.2.80.0960.01114.95
7.2.70.1170.00614.84
7.2.60.1090.00615.08
7.2.50.0780.01214.85
7.2.40.1000.01314.53
7.2.30.0150.00714.84
7.2.20.0860.01314.88
7.2.10.0460.01114.59
7.2.00.0640.00714.68
7.1.230.0730.00613.92
7.1.220.0760.01313.94
7.1.210.0830.00713.53
7.1.200.0550.00313.67
7.1.190.0410.00413.78
7.1.180.0820.00313.91
7.1.170.0980.01313.36
7.1.160.0650.01613.66
7.1.150.0580.01213.95
7.1.140.0290.01113.27
7.1.130.0300.00913.56
7.1.120.0890.01013.55
7.1.110.0670.01013.90
7.1.100.1000.01013.70
7.1.90.0930.01013.65
7.1.80.0630.00713.71
7.1.70.0670.00413.55
7.1.60.0280.01631.41
7.1.50.0370.01332.06
7.1.40.0280.01231.29
7.1.30.0260.01531.59
7.1.20.0600.02031.33
7.1.10.0330.00713.74
7.1.00.0420.00913.72
5.6.380.0030.01214.08

preferences:
64.82 ms | 401 KiB | 5 Q