3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Roman { public $dividorsBelowTen = [0 => "", 1 => "I", 2 => "II", 3 => "III", 4 => "IV", 5 => "V", 6 => "VI", 7 => "VII", 8 => "VIII", 9 => "IX"]; public $dividorsTen = [0 => "", 1 => "X", 2 => "XX", 3 => "XXX", 4 => "XL", 5 => "L", 6 => "LX", 7 => "LXX", 8 => "LXXX", 9 => "XC"]; public $dividorsHundreds = [0 => "", 1 => "C", 2 => "CC", 3 => "CCC", 4 => "CD", 5 => "D", 6 => "DC", 7 => "DCC", 8 => "DCCC", 9 => "CM",]; public $dividorsThousands = [1 => "M", 2 => "MM", 3 => "MMM", 4 => "MMMM"]; public function transform($in) { if ($in >= 1000) { $thousand = (int)($in / 1000); $hundreds = (int)(($in - $thousand * 1000) / 100); $tens = (int)(($in - $thousand * 1000 - $hundreds * 100) / 10); $once = ($in - $thousand * 1000 - $hundreds * 100 - $tens * 10); return $this->dividorsThousands[$thousand] . $this->dividorsHundreds[$hundreds] . $this->dividorsTen[$tens] . $this->dividorsBelowTen[$once]; } else if ($in >= 100) { $hundreds = (int)($in / 100); $tens = (int)(($in - $hundreds * 100) / 10); $once = ($in - $hundreds * 100 - $tens * 10); return $this->dividorsHundreds[$hundreds] . $this->dividorsTen[$tens] . $this->dividorsBelowTen[$once]; } else if ($in >= 10) { $once = $in % 10; $tens = (int)($in / 10); return $this->dividorsTen[$tens] . $this->dividorsBelowTen[$once]; } else { return $this->dividorsBelowTen[$in]; } } } $r = new Roman(); for ($i = 1; $i < 5000; $i++) { $r->transform($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.0060.01216.58
8.3.60.0090.00616.50
8.3.50.0110.01021.97
8.3.40.0130.00318.71
8.3.30.0160.00019.22
8.3.20.0040.00420.29
8.3.10.0060.00320.48
8.3.00.0090.00019.38
8.2.180.0170.00716.50
8.2.170.0120.01222.96
8.2.160.0100.00620.43
8.2.150.0050.00524.18
8.2.140.0000.00824.66
8.2.130.0050.00326.16
8.2.120.0060.00320.87
8.2.110.0080.00320.56
8.2.100.0000.01317.99
8.2.90.0070.00319.40
8.2.80.0060.00317.97
8.2.70.0100.00017.50
8.2.60.0030.00618.04
8.2.50.0030.00618.07
8.2.40.0100.00318.08
8.2.30.0040.00419.47
8.2.20.0060.00317.84
8.2.10.0030.00618.04
8.2.00.0030.00617.66
8.1.280.0080.00825.92
8.1.270.0090.00023.88
8.1.260.0000.01126.35
8.1.250.0030.00628.09
8.1.240.0040.00723.73
8.1.230.0060.00619.01
8.1.220.0040.00417.74
8.1.210.0040.00418.77
8.1.200.0050.00517.13
8.1.190.0060.00317.35
8.1.180.0040.00418.10
8.1.170.0030.00618.56
8.1.160.0060.00321.93
8.1.150.0030.00618.80
8.1.140.0060.00317.54
8.1.130.0080.00017.91
8.1.120.0040.00417.42
8.1.110.0000.01017.54
8.1.100.0040.00417.41
8.1.90.0080.00017.45
8.1.80.0040.00417.52
8.1.70.0040.00417.51
8.1.60.0000.01017.64
8.1.50.0030.00717.54
8.1.40.0040.00417.59
8.1.30.0070.00317.66
8.1.20.0000.00917.63
8.1.10.0060.00317.59
8.1.00.0030.00617.44
8.0.300.0000.00818.77
8.0.290.0000.00816.75
8.0.280.0030.00518.49
8.0.270.0030.00617.18
8.0.260.0070.00017.30
8.0.250.0000.00816.98
8.0.240.0080.00017.04
8.0.230.0030.00516.97
8.0.220.0000.00816.93
8.0.210.0030.00816.93
8.0.200.0040.00416.89
8.0.190.0000.00816.96
8.0.180.0030.00616.92
8.0.170.0070.00316.95
8.0.160.0000.01016.89
8.0.150.0000.00916.93
8.0.140.0060.00316.77
8.0.130.0030.00313.29
8.0.120.0050.00516.95
8.0.110.0000.00916.95
8.0.100.0000.00916.93
8.0.90.0040.00416.93
8.0.80.0110.00816.87
8.0.70.0060.00316.81
8.0.60.0040.00416.93
8.0.50.0060.00316.73
8.0.30.0060.01517.26
8.0.20.0110.02417.40
8.0.10.0030.00616.92
8.0.00.0110.01216.91
7.4.330.0000.00615.09
7.4.320.0000.00816.62
7.4.300.0070.00016.55
7.4.290.0000.00816.56
7.4.280.0030.00616.54
7.4.270.0030.00516.57
7.4.260.0030.00616.63
7.4.250.0060.00316.51
7.4.240.0000.00916.47
7.4.230.0070.00416.48
7.4.220.0110.01116.49
7.4.210.0140.01016.57
7.4.200.0040.00416.63
7.4.160.0060.01216.52
7.4.150.0080.01217.40
7.4.140.0080.01217.86
7.4.130.0110.00816.59
7.4.120.0100.01016.49
7.4.110.0040.01516.59
7.4.100.0070.01416.56
7.4.90.0070.01116.40
7.4.80.0060.01619.39
7.4.70.0110.00716.48
7.4.60.0090.01016.57
7.4.50.0070.00316.29
7.4.40.0090.00916.69
7.4.30.0080.01516.70
7.4.10.0070.01415.16
7.4.00.0110.00915.08
7.3.330.0030.00313.26
7.3.320.0000.00713.24
7.3.310.0030.00516.26
7.3.300.0040.00416.34
7.3.290.0070.01716.29
7.3.280.0050.01416.38
7.3.270.0120.00617.40
7.3.260.0130.01316.38
7.3.250.0090.00916.44
7.3.240.0110.00816.57
7.3.230.0100.01616.41
7.3.210.0140.01116.54
7.3.200.0060.01219.39
7.3.190.0090.00916.61
7.3.180.0100.00716.57
7.3.170.0120.00616.59
7.3.160.0100.01016.51
7.3.130.0070.01414.86
7.3.120.0040.01514.92
7.3.110.0060.01614.59
7.3.100.0070.00714.59
7.3.90.0030.01214.60
7.3.80.0000.01414.55
7.3.70.0060.00614.68
7.3.60.0030.01114.61
7.3.50.0070.00714.83
7.3.40.0060.00614.97
7.3.30.0110.00715.02
7.3.20.0070.00716.49
7.3.10.0060.00916.64
7.3.00.0050.00816.66
7.2.330.0060.01316.70
7.2.320.0070.01816.57
7.2.310.0090.01516.58
7.2.300.0040.01816.69
7.2.290.0100.01016.47
7.2.260.0070.01014.73
7.2.250.0060.01315.04
7.2.240.0030.01614.95
7.2.230.0120.00615.39
7.2.220.0100.00715.08
7.2.210.0030.01315.10
7.2.200.0040.01114.99
7.2.190.0000.02115.30
7.2.180.0030.01015.04
7.2.170.0070.01014.93
7.2.160.0070.01015.09
7.2.150.0040.01116.67
7.2.140.0060.00616.91
7.2.130.0070.01017.00
7.2.120.0050.01216.87
7.2.110.0060.00616.94
7.2.100.0090.00916.94
7.2.90.0060.00916.98
7.2.80.0040.01016.85
7.2.70.0040.01416.93
7.2.60.0080.00816.92
7.2.50.0040.01016.94
7.2.40.0030.01217.00
7.2.30.0070.01017.02
7.2.20.0070.01016.87
7.2.10.0060.00717.13
7.2.00.0060.00816.85
7.1.330.0070.01015.84
7.1.320.0030.01615.85
7.1.310.0030.01315.58
7.1.300.0040.01515.70
7.1.290.0100.00315.85
7.1.280.0090.00615.55
7.1.270.0030.00915.77
7.1.260.0070.00715.94
7.1.250.0020.01515.89
7.1.240.0040.00815.67
7.1.230.0080.00915.73
7.1.220.0020.01715.89
7.1.210.0050.01215.78
7.1.200.0060.01015.68
7.1.190.0020.01215.64
7.1.180.0020.01615.87
7.1.170.0050.01015.72
7.1.160.0030.01215.66
7.1.150.0050.00915.72
7.1.140.0090.00815.84
7.1.130.0030.01115.68
7.1.120.0030.01415.82
7.1.110.0050.01215.79
7.1.100.0070.00916.60
7.1.90.0020.01215.77
7.1.80.0050.01515.81
7.1.70.0030.01116.33
7.1.60.0070.01317.04
7.1.50.0060.01322.07
7.1.40.0070.01015.82
7.1.30.0070.00715.64
7.1.20.0050.01115.81
7.1.10.0100.01015.63
7.1.00.0070.03117.86
7.0.330.0000.01615.52
7.0.320.0040.01315.33
7.0.310.0060.00915.43
7.0.300.0000.01315.32
7.0.290.0030.01215.29
7.0.280.0040.00815.41
7.0.270.0020.01415.44
7.0.260.0090.00915.29
7.0.250.0040.01215.59
7.0.240.0070.00815.33
7.0.230.0020.01615.41
7.0.220.0100.00615.26
7.0.210.0020.01415.34
7.0.200.0040.01115.82
7.0.190.0070.00815.50
7.0.180.0030.01115.39
7.0.170.0050.01015.46
7.0.160.0030.01215.38
7.0.150.0020.01415.44
7.0.140.0070.03017.63
7.0.130.0100.00615.61
7.0.120.0050.01115.42
7.0.110.0070.01215.27
7.0.100.0070.01315.58
7.0.90.0100.00515.40
7.0.80.0060.00915.18
7.0.70.0050.01215.59
7.0.60.0060.02916.89
7.0.50.0120.02816.26
7.0.40.0060.02715.68
7.0.30.0170.02915.67
7.0.20.0110.03315.65
7.0.10.0040.03915.71
7.0.00.0090.03515.58
5.6.400.0070.01314.59
5.6.390.0030.01914.44
5.6.380.0030.01714.51
5.6.370.0030.01614.37
5.6.360.0020.01714.56
5.6.350.0020.01314.70
5.6.340.0090.00814.28
5.6.330.0050.01314.11
5.6.320.0020.01514.32
5.6.310.0020.01414.57
5.6.300.0050.01614.42
5.6.290.0030.01314.53
5.6.280.0050.03516.56
5.6.270.0000.01814.30
5.6.260.0060.01314.46
5.6.250.0030.01714.53
5.6.240.0030.01614.41
5.6.230.0060.01414.40
5.6.220.0090.01514.51
5.6.210.0050.04216.52
5.6.200.0080.03015.60
5.6.190.0080.03816.36
5.6.180.0210.02716.32
5.6.170.0110.02116.47
5.6.160.0090.01816.45
5.6.150.0100.02515.66
5.6.140.0070.03515.72
5.6.130.0050.03315.57
5.6.120.0100.02416.50
5.6.110.0020.04216.62
5.6.100.0040.03316.57
5.6.90.0060.03416.69
5.6.80.0060.03416.37
5.6.70.0050.01314.29
5.6.60.0070.01214.27
5.6.50.0020.01514.35
5.6.40.0070.01114.30
5.6.30.0020.01714.37
5.6.20.0060.01414.33
5.6.10.0030.01514.30
5.6.00.0050.01314.39
5.5.380.0050.01612.63
5.5.370.0030.01312.72
5.5.360.0030.01212.81
5.5.350.0120.02915.42
5.5.340.0040.02814.57
5.5.330.0050.03315.10
5.5.320.0050.02415.23
5.5.310.0170.03215.21
5.5.300.0070.02414.45
5.5.290.0070.03414.33
5.5.280.0060.03915.40
5.5.270.0120.03415.51
5.5.260.0100.03715.38
5.5.250.0060.03315.42
5.5.240.0100.03515.25
5.5.230.0060.01112.68
5.5.220.0020.01712.71
5.5.210.0050.01212.79
5.5.200.0070.01112.69
5.5.190.0070.01012.79
5.5.180.0070.01212.62
5.5.170.0030.01412.69
5.5.160.0030.01912.61
5.5.150.0050.01512.66
5.5.140.0030.01212.79
5.5.130.0090.00812.78
5.5.120.0040.01212.79
5.5.110.0050.01312.87
5.5.100.0020.01812.54
5.5.90.0030.01612.76
5.5.80.0030.01412.63
5.5.70.0040.01312.64
5.5.60.0050.01512.81
5.5.50.0050.01212.70
5.5.40.0060.01212.52
5.5.30.0070.01112.74
5.5.20.0000.01912.84
5.5.10.0050.01712.69
5.5.00.0080.01212.73
5.4.450.0040.03114.44
5.4.440.0120.03314.49
5.4.430.0090.02414.48
5.4.420.0120.03014.55
5.4.410.0110.02014.48
5.4.400.0080.02414.31
5.4.390.0090.03214.27
5.4.380.0040.02814.37
5.4.370.0090.02314.44
5.4.360.0060.02314.34
5.4.350.0110.03314.36
5.4.340.0090.02114.33
5.4.330.0060.01111.80
5.4.320.0120.02114.46
5.4.310.0150.03014.35
5.4.300.0100.02114.31
5.4.290.0090.03414.28
5.4.280.0120.02114.32
5.4.270.0130.02014.50
5.4.260.0100.02414.29
5.4.250.0110.03114.42
5.4.240.0070.02914.29
5.4.230.0100.03014.40
5.4.220.0090.02814.49
5.4.210.0180.02414.32
5.4.200.0090.03714.34
5.4.190.0120.02314.41
5.4.180.0100.03414.26
5.4.170.0130.03314.46
5.4.160.0110.03214.49
5.4.150.0140.03114.33
5.4.140.0100.03313.58
5.4.130.0080.03413.48
5.4.120.0120.02113.51
5.4.110.0110.02013.54
5.4.100.0040.03813.55
5.4.90.0120.03013.57
5.4.80.0080.02613.61
5.4.70.0110.03113.30
5.4.60.0090.03313.45
5.4.50.0110.02413.46
5.4.40.0090.03013.53
5.4.30.0110.02213.56
5.4.20.0100.02613.54
5.4.10.0100.02013.60
5.4.00.0090.02013.32
5.3.290.0140.03912.52
5.3.280.0160.03612.53
5.3.270.0170.02812.45
5.3.260.0100.02712.41
5.3.250.0150.03712.51
5.3.240.0170.02812.46
5.3.230.0120.03812.47
5.3.220.0170.03312.45
5.3.210.0100.03912.41
5.3.200.0080.02812.37
5.3.190.0180.03012.52
5.3.180.0130.03612.46
5.3.170.0160.03012.61
5.3.160.0160.03012.50
5.3.150.0150.03712.46
5.3.140.0130.03312.55
5.3.130.0150.03612.41
5.3.120.0110.03312.46
5.3.110.0130.02412.42
5.3.100.0120.04112.19
5.3.90.0120.02512.28
5.3.80.0190.03012.16
5.3.70.0160.02812.12
5.3.60.0160.03212.17
5.3.50.0100.02912.12
5.3.40.0150.03312.14
5.3.30.0160.03712.05
5.3.20.0130.03812.08
5.3.10.0150.02312.01
5.3.00.0130.03811.93
5.2.170.0150.02911.29
5.2.160.0110.02611.29
5.2.150.0110.02711.29
5.2.140.0080.03011.29
5.2.130.0130.02811.29
5.2.120.0080.01911.29
5.2.110.0150.02811.29
5.2.100.0130.02811.29
5.2.90.0100.02311.29
5.2.80.0130.03211.29
5.2.70.0080.03211.29
5.2.60.0080.02211.29
5.2.50.0090.01611.29
5.2.40.0110.03111.29
5.2.30.0100.02211.29
5.2.20.0050.04011.29
5.2.10.0070.02511.29
5.2.00.0080.02811.29
5.1.60.0120.02511.29
5.1.50.0080.02411.29
5.1.40.0090.01911.29
5.1.30.0100.01511.29
5.1.20.0050.02411.29
5.1.10.0100.02411.29
5.1.00.0050.02011.29
5.0.50.0100.02211.29
5.0.40.0080.01511.29
5.0.30.0060.02511.29
5.0.20.0060.01311.29
5.0.10.0050.01911.29
5.0.00.0050.01611.29
4.4.90.0030.01311.29
4.4.80.0050.01011.29
4.4.70.0050.01511.29
4.4.60.0070.01011.29
4.4.50.0050.01011.29
4.4.40.0050.01511.29
4.4.30.0030.01011.29
4.4.20.0070.00811.29
4.4.10.0030.01411.29
4.4.00.0050.02311.29
4.3.110.0030.01211.29
4.3.100.0050.01711.29
4.3.90.0030.01211.29
4.3.80.0050.01711.29
4.3.70.0060.01611.29
4.3.60.0060.01811.29
4.3.50.0090.01411.29
4.3.40.0070.02611.29
4.3.30.0030.01811.29
4.3.20.0020.02011.29
4.3.10.0020.01711.29
4.3.00.0050.01811.29

preferences:
39.4 ms | 401 KiB | 5 Q