3v4l.org

run code in 300+ PHP versions simultaneously
<?php function numberToRoman(int $integer): string { static $conversions = [ 1000 => 'M', 900 => 'CM', 500 => 'D', 400 => 'CD', 100 => 'C', 90 => 'XC', 50 => 'L', 40 => 'XL', 10 => 'X', 9 => 'IX', 5 => 'V', 4 => 'IV', 1 => 'I' ]; $romanString = ''; foreach ($conversions as $int => $roman) { while ($integer >= $int) { $romanString .= $roman; $integer -= $int; if (!$integer) { break 2; } } } return $romanString; } echo numberToRoman(3333); echo "\n---\n"; echo numberToRoman(5000);

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.5.00.0140.00721.84
8.4.150.0010.00014.05
8.4.140.0170.00417.39
8.4.130.0060.01119.36
8.4.120.0100.00720.48
8.4.110.0110.00822.46
8.4.100.0090.00318.02
8.4.90.0090.01222.33
8.4.80.0060.00320.77
8.4.70.0060.01018.86
8.4.60.0150.00520.66
8.4.50.0140.00619.50
8.4.40.0130.00319.36
8.4.30.0120.00618.80
8.4.20.0060.00317.63
8.4.10.0040.00422.13
8.3.280.0160.00818.36
8.3.270.0150.00916.56
8.3.260.0120.00816.65
8.3.250.0070.01118.91
8.3.240.0070.00216.55
8.3.230.0120.00416.53
8.3.220.0110.00718.93
8.3.210.0110.00216.68
8.3.200.0020.00716.65
8.3.190.0120.00717.21
8.3.180.0060.00218.29
8.3.170.0150.00317.09
8.3.160.0040.01016.47
8.3.150.0110.00717.29
8.3.140.0070.00316.46
8.3.130.0080.00018.46
8.3.120.0040.00718.87
8.3.110.0120.00320.94
8.3.100.0050.00516.76
8.3.90.0030.01426.77
8.3.80.0030.00616.88
8.3.70.0130.00916.58
8.3.60.0150.00018.42
8.3.50.0090.00920.00
8.3.40.0090.01220.22
8.3.30.0040.01118.74
8.3.20.0040.00424.18
8.3.10.0080.00024.66
8.3.00.0060.00326.16
8.2.290.0050.00516.98
8.2.280.0110.00818.14
8.2.270.0120.00616.59
8.2.260.0120.00618.63
8.2.250.0100.00718.36
8.2.240.0090.00017.34
8.2.230.0100.00722.58
8.2.220.0040.00424.06
8.2.210.0080.00026.77
8.2.200.0060.00316.63
8.2.190.0040.01116.58
8.2.180.0090.00625.92
8.2.170.0080.00818.82
8.2.160.0140.00022.96
8.2.150.0050.00225.66
8.2.140.0000.00824.66
8.2.130.0040.00426.16
8.2.120.0020.00526.16
8.2.110.0060.00321.06
8.2.100.0040.00719.89
8.2.90.0050.00319.63
8.2.80.0050.00218.16
8.2.70.0080.00017.93
8.2.60.0030.00518.03
8.2.50.0040.00418.10
8.2.40.0060.00319.53
8.2.30.0040.00418.06
8.2.20.0070.00019.32
8.2.10.0040.00418.16
8.2.00.0020.00719.38
8.1.330.0140.00423.54
8.1.320.0120.00623.85
8.1.310.0120.00616.75
8.1.300.0060.01017.77
8.1.290.0090.00030.84
8.1.280.0140.00725.92
8.1.270.0080.00024.66
8.1.260.0080.00026.35
8.1.250.0040.00428.09
8.1.240.0040.00423.82
8.1.230.0040.00722.68
8.1.220.0030.00517.79
8.1.210.0030.00518.77
8.1.200.0050.00317.35
8.1.190.0040.00417.39
8.1.180.0060.00318.10
8.1.170.0040.00418.50
8.1.160.0000.00718.81
8.1.150.0040.00418.64
8.1.140.0030.00717.45
8.1.130.0010.00619.10
8.1.120.0030.00518.40
8.1.110.0020.00718.39
8.1.100.0100.00417.52
8.1.90.0090.00417.48
8.1.80.0160.00217.46
8.1.70.0060.00617.46
8.1.60.0130.00517.54
8.1.50.0170.00217.54
8.1.40.0170.00217.49
8.1.30.0140.00817.61
8.1.20.0110.00717.60
8.1.10.0130.00517.57
8.1.00.0110.00817.44
8.0.300.0040.00419.68
8.0.290.0070.00016.88
8.0.280.0030.00318.38
8.0.270.0040.00417.89
8.0.260.0070.00517.55
8.0.250.0050.00716.91
8.0.240.0050.00516.83
8.0.230.0050.00916.83
8.0.220.0090.00616.75
8.0.210.0070.00716.82
8.0.200.0110.00316.82
8.0.190.0100.00416.75
8.0.180.0090.00516.55
8.0.170.0070.00516.69
8.0.160.0080.00516.56
8.0.150.0110.00516.59
8.0.140.0040.00716.86
8.0.130.0100.00516.58
8.0.120.0110.00416.66
8.0.110.0080.00516.53
8.0.100.0080.00516.60
8.0.90.0070.00516.58
8.0.80.0090.00416.81
8.0.70.0100.00216.53
8.0.60.0100.00316.63
8.0.50.0090.00317.42
8.0.30.0040.00717.46
8.0.20.0080.00316.78
8.0.10.0090.00416.90
7.4.330.0060.00415.22
7.4.320.0050.00716.51
7.4.300.0130.00216.18
7.4.290.0100.00516.26
7.4.280.0080.00616.33
7.4.270.0100.00416.23
7.4.260.0100.00416.12
7.4.250.0080.00616.20
7.4.240.0090.00616.39
7.4.230.0140.00116.44
7.4.220.0110.00316.30
7.4.210.0090.00716.30
7.4.200.0060.00616.34
7.4.190.0150.00216.41
7.4.180.0090.00516.27
7.4.160.0090.00316.34
7.4.150.0080.00416.43
7.4.140.0070.00516.30
7.4.130.0080.00416.13
7.4.120.0090.00516.24
7.4.110.0130.00216.17
7.4.100.0120.00316.39
7.4.90.0110.00416.21
7.4.80.0080.00616.16
7.4.70.0120.00216.41
7.4.60.0070.00716.24
7.4.50.0090.00316.28
7.4.40.0090.00516.17
7.4.30.0120.00116.28
7.4.20.0070.00616.19
7.4.10.0090.00516.12
7.4.00.0110.00216.20

preferences:
29.31 ms | 403 KiB | 5 Q