3v4l.org

run code in 300+ PHP versions simultaneously
<?php function numberToRoman($decimalNumber) { static $romanSymbolsMap = array('M' => 1000, 'CM' => 900, 'D' => 500, 'CD' => 400, 'C' => 100, 'XC' => 90, 'L' => 50, 'XL' => 40, 'X' => 10, 'IX' => 9, 'V' => 5, 'IV' => 4, 'I' => 1); $result = ''; foreach ($romanSymbolsMap as $roman => $decimal) { if ($decimalNumber >= $decimal) { $result .= str_repeat($roman, $decimalNumber / $decimal); $decimalNumber %= $decimal; } } return $result; } for ($j=0;$j<10;$j++){ for ($i = 1; $i < 5000; $i++) { numberToRoman($i); } }

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.70.0050.01516.58
8.3.60.0160.01016.61
8.3.50.0140.01721.96
8.3.40.0160.01318.79
8.3.30.0270.01319.08
8.3.20.0110.00320.16
8.3.10.0120.00020.36
8.3.00.0040.00419.50
8.2.180.0160.01216.38
8.2.170.0220.00922.96
8.2.160.0160.01620.28
8.2.150.0140.00024.18
8.2.140.0080.00824.66
8.2.130.0090.00526.16
8.2.120.0070.00220.97
8.2.110.0030.00620.43
8.2.100.0100.00718.22
8.2.90.0050.00519.26
8.2.80.0040.00417.97
8.2.70.0000.01217.75
8.2.60.0030.00618.03
8.2.50.0040.00818.07
8.2.40.0160.00318.18
8.2.30.0110.00019.45
8.2.20.0060.00617.74
8.2.10.0060.00618.20
8.2.00.0110.00017.74
8.1.280.0180.00925.92
8.1.270.0150.00023.96
8.1.260.0090.00626.35
8.1.250.0090.00928.09
8.1.240.0060.01223.88
8.1.230.0110.00619.04
8.1.220.0000.01217.74
8.1.210.0000.01018.77
8.1.200.0000.01517.22
8.1.190.0050.00517.23
8.1.180.0030.00918.10
8.1.170.0000.01118.49
8.1.160.0040.00822.08
8.1.150.0000.00918.87
8.1.140.0000.01117.52
8.1.130.0070.00317.84
8.1.120.0030.00817.54
8.1.110.0080.00417.41
8.1.100.0030.00917.49
8.1.90.0040.00817.51
8.1.80.0110.00017.56
8.1.70.0000.01217.46
8.1.60.0050.00517.65
8.1.50.0000.01417.46
8.1.40.0000.01017.46
8.1.30.0060.00617.67
8.1.20.0050.00317.65
8.1.10.0050.00517.58
8.1.00.0050.00517.49
8.0.300.0070.02618.77
8.0.290.0060.02816.63
8.0.280.0000.03418.40
8.0.270.0000.03317.27
8.0.260.0030.03117.29
8.0.250.0030.03016.92
8.0.240.0060.02516.92
8.0.230.0070.02617.00
8.0.220.0000.03316.92
8.0.210.0030.03016.94
8.0.200.0000.03316.96
8.0.190.0030.03616.95
8.0.180.0030.03716.81
8.0.170.0070.03416.93
8.0.160.0000.04216.97
8.0.150.0030.03616.86
8.0.140.0030.03716.83
8.0.130.0060.03113.31
8.0.120.0000.04016.88
8.0.110.0030.03616.79
8.0.100.0000.04216.88
8.0.90.0000.04016.88
8.0.80.0060.05316.94
8.0.70.0100.02916.71
8.0.60.0030.03816.86
8.0.50.0040.03816.91
8.0.30.0160.05216.74
8.0.20.0100.05317.40
8.0.10.0030.03616.78
8.0.00.0090.05316.67
7.4.330.0000.03115.13
7.4.320.0000.03116.50
7.4.300.0000.03216.61
7.4.290.0030.03516.61
7.4.280.0030.03716.59
7.4.270.0000.03916.51
7.4.260.0070.03216.47
7.4.250.0070.03316.46
7.4.240.0020.03716.60
7.4.230.0000.04116.34
7.4.220.0120.05616.61
7.4.210.0130.05316.61
7.4.200.0030.03516.70
7.4.160.0100.04616.43
7.4.150.0100.05417.40
7.4.140.0130.05017.86
7.4.130.0060.05316.62
7.4.120.0160.04216.49
7.4.110.0060.05216.52
7.4.100.0090.06216.46
7.4.90.0090.05316.71
7.4.80.0150.07919.39
7.4.70.0130.04616.56
7.4.60.0100.05316.41
7.4.50.0060.04516.48
7.4.40.0100.05016.51
7.4.30.0100.06316.67
7.4.00.0070.05014.91
7.3.330.0000.04613.34
7.3.320.0000.03813.32
7.3.310.0030.03616.22
7.3.300.0000.03916.21
7.3.290.0070.06516.35
7.3.280.0100.06816.35
7.3.270.0130.05417.40
7.3.260.0130.06916.57
7.3.250.0150.04616.49
7.3.240.0040.06116.41
7.3.230.0130.04916.53
7.3.210.0100.06416.38
7.3.200.0090.08319.39
7.3.190.0100.05216.49
7.3.180.0030.06016.34
7.3.170.0100.05516.43
7.3.160.0170.04116.34
7.2.330.0120.05116.71
7.2.320.0060.06416.76
7.2.310.0160.05716.62
7.2.300.0100.06916.62
7.2.290.0030.06416.86
7.2.60.0030.04616.77
7.2.00.0000.05319.47
7.1.200.0000.06315.61
7.1.100.0030.05117.88
7.1.70.0000.05017.23
7.1.60.0100.10119.61
7.1.50.0200.09234.84
7.1.00.0030.14322.33
7.0.200.0030.05416.54
7.0.140.0070.14722.09
7.0.60.0170.12019.88
7.0.50.0000.10017.85
7.0.40.0100.10320.11
7.0.30.0470.09720.25
7.0.20.0270.13320.05
7.0.10.0130.13720.10
7.0.00.0070.08320.12
5.6.280.0070.22721.03
5.6.210.0130.20020.54
5.6.200.0100.19718.22
5.6.190.0070.17720.55
5.6.180.0430.17320.61
5.6.170.0330.14020.46
5.6.160.0070.14020.55
5.6.150.0070.19718.19
5.6.140.0070.19318.19
5.6.130.0070.15018.17
5.6.120.0030.20320.91
5.6.110.0030.20721.13
5.6.100.0000.13721.02
5.6.90.0000.14020.89
5.6.80.0070.21020.38
5.5.350.0130.18020.38
5.5.340.0030.15717.95
5.5.330.0030.17020.57
5.5.320.0000.21320.34
5.5.310.0270.17320.36
5.5.300.0070.17317.98
5.5.290.0170.13018.07
5.5.280.0130.20320.80
5.5.270.0170.19320.72
5.5.260.0070.13720.96
5.5.250.0070.14720.80
5.5.240.0200.19020.27
5.4.450.0370.16319.40
5.4.440.0100.14319.29
5.4.430.0730.20319.51
5.4.420.0830.28019.38
5.4.410.0830.24719.26
5.4.400.0730.25019.22
5.4.390.0870.21019.11
5.4.380.0230.21718.70
5.4.370.0300.24018.56
5.4.360.0300.19718.46
5.4.350.0330.22018.81
5.4.340.0330.24318.73
5.4.320.0090.14512.50
5.4.310.0100.13712.50
5.4.300.0100.15012.50
5.4.290.0100.14312.50
5.4.280.0070.13812.40
5.4.270.0040.14812.40
5.4.260.0030.15112.39
5.4.250.0070.16312.40
5.4.240.0100.13512.40
5.4.230.0100.13812.39
5.4.220.0060.14812.39
5.4.210.0090.14612.39
5.4.200.0050.14212.39
5.4.190.0090.15412.39
5.4.180.0100.15212.39
5.4.170.0080.15512.39
5.4.160.0090.16212.39
5.4.150.0080.14812.38
5.4.140.0100.13612.07
5.4.130.0070.15212.05
5.4.120.0060.15912.02
5.4.110.0080.15312.01
5.4.100.0030.14912.01
5.4.90.0070.15412.01
5.4.80.0040.14712.02
5.4.70.0050.15112.01
5.4.60.0100.15412.01
5.4.50.0040.14412.01
5.4.40.0060.15612.00
5.4.30.0050.15211.99
5.4.20.0040.15311.99
5.4.10.0070.16012.00
5.4.00.0050.15511.48
5.3.290.0080.16112.80
5.3.280.0130.15212.71
5.3.270.0070.15012.72
5.3.260.0110.14912.71
5.3.250.0070.15512.72
5.3.240.0090.14712.72
5.3.230.0100.15612.71
5.3.220.0060.21412.68
5.3.210.0060.16612.68
5.3.200.0050.16712.68
5.3.190.0070.15112.68
5.3.180.0130.15312.67
5.3.170.0080.17312.67
5.3.160.0100.17012.68
5.3.150.0070.16212.67
5.3.140.0080.16312.66
5.3.130.0060.15712.65
5.3.120.0040.17112.66
5.3.110.0080.16712.66
5.3.100.0080.15012.12
5.3.90.0080.16912.10
5.3.80.0100.15412.09
5.3.70.0090.16212.09
5.3.60.0090.17112.08
5.3.50.0050.16712.02
5.3.40.0040.17812.03
5.3.30.0080.15611.98
5.3.20.0070.15411.77
5.3.10.0050.16111.73
5.3.00.0040.16311.72
5.2.170.0030.1819.22
5.2.160.0040.1929.22
5.2.150.0070.1899.22
5.2.140.0110.1769.21
5.2.130.0050.1839.18
5.2.120.0050.1889.18
5.2.110.0020.1939.18
5.2.100.0020.1759.18
5.2.90.0050.1919.18
5.2.80.0090.1719.18
5.2.70.0050.1809.18
5.2.60.0090.1889.13
5.2.50.0030.1869.10
5.2.40.0040.1859.07
5.2.30.0040.1789.05
5.2.20.0050.1869.03
5.2.10.0070.1748.94
5.2.00.0040.1778.81
5.1.60.0040.1858.09
5.1.50.0050.1978.09
5.1.40.0050.2018.07
5.1.30.0030.1938.42
5.1.20.0030.1858.45
5.1.10.0050.1928.17
5.1.00.0040.1918.16
5.0.50.0060.5006.65
5.0.40.0020.4616.51
5.0.30.0080.4846.32
5.0.20.0030.4716.29
5.0.10.0080.4586.27
5.0.00.0050.5106.26
4.4.90.0030.4994.78
4.4.80.0040.4824.76
4.4.70.0030.4964.75
4.4.60.0030.4824.76
4.4.50.0040.4944.77
4.4.40.0070.4914.70
4.4.30.0050.4894.76
4.4.20.0040.4894.84
4.4.10.0060.4704.85
4.4.00.0040.5004.76
4.3.110.0070.4904.67
4.3.100.0030.4784.66
4.3.90.0030.4764.64
4.3.80.0040.5204.59
4.3.70.0080.5004.63
4.3.60.0070.4964.63
4.3.50.0040.4824.63
4.3.40.0050.5214.53
4.3.30.0070.5253.31
4.3.20.0010.4673.29
4.3.10.0140.6173.25
4.3.00.0070.35314.28

preferences:
46.6 ms | 401 KiB | 5 Q