3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Roman 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)
5.4.320.0080.04012.51
5.4.310.0050.04412.51
5.4.300.0070.04412.51
5.4.290.0080.04312.50
5.4.280.0070.04112.40
5.4.270.0080.04212.40
5.4.260.0070.03812.40
5.4.250.0110.03712.40
5.4.240.0080.03212.40
5.4.230.0060.03912.39
5.4.220.0050.03912.39
5.4.210.0070.03612.39
5.4.200.0050.03912.39
5.4.190.0030.04312.39
5.4.180.0080.03612.39
5.4.170.0060.03712.39
5.4.160.0060.03612.39
5.4.150.0130.03912.39
5.4.140.0100.03912.08
5.4.130.0040.03812.06
5.4.120.0070.04112.03
5.4.110.0050.04412.02
5.4.100.0070.03512.02
5.4.90.0080.03612.02
5.4.80.0100.03712.03
5.4.70.0090.03512.02
5.4.60.0060.04512.02
5.4.50.0040.03812.02
5.4.40.0070.04212.00
5.4.30.0050.03812.00
5.4.20.0040.03912.00
5.4.10.0070.03712.01
5.4.00.0080.03211.49
5.3.290.0080.04012.80
5.3.280.0050.04812.71
5.3.270.0100.03712.72
5.3.260.0080.04212.72
5.3.250.0070.03812.72
5.3.240.0060.03712.72
5.3.230.0040.04112.71
5.3.220.0090.03512.68
5.3.210.0070.04212.68
5.3.200.0050.04512.68
5.3.190.0080.04412.68
5.3.180.0120.03412.67
5.3.170.0080.05112.67
5.3.160.0060.03812.68
5.3.150.0030.04612.67
5.3.140.0080.04112.66
5.3.130.0070.04412.66
5.3.120.0070.04312.66
5.3.110.0050.04712.66
5.3.100.0050.03712.12
5.3.90.0070.04312.10
5.3.80.0080.03712.09
5.3.70.0120.04012.09
5.3.60.0070.04412.07
5.3.50.0080.04412.02
5.3.40.0120.04112.02
5.3.30.0100.03811.98
5.3.20.0040.04711.77
5.3.10.0040.04211.73
5.3.00.0080.04211.71
5.2.170.0110.0299.21
5.2.160.0090.0259.21
5.2.150.0060.0309.21
5.2.140.0050.0329.21
5.2.130.0070.0299.18
5.2.120.0030.0319.18
5.2.110.0050.0319.18
5.2.100.0060.0279.18
5.2.90.0070.0299.18
5.2.80.0030.0349.17
5.2.70.0060.0309.17
5.2.60.0120.0319.13
5.2.50.0070.0359.10
5.2.40.0060.0279.07
5.2.30.0040.0389.04
5.2.20.0070.0279.04
5.2.10.0030.0308.94
5.2.00.0050.0328.80
5.1.60.0020.0338.09
5.1.50.0040.0288.08
5.1.40.0030.0368.07
5.1.30.0080.0298.41
5.1.20.0040.0358.43
5.1.10.0040.0288.16
5.1.00.0060.0248.16
5.0.50.0040.0296.63
5.0.40.0060.0246.50
5.0.30.0030.0406.31
5.0.20.0030.0296.27
5.0.10.0050.0266.26
5.0.00.0070.0316.25
4.4.90.0020.0214.78
4.4.80.0020.0224.76
4.4.70.0030.0184.76
4.4.60.0020.0174.76
4.4.50.0030.0184.77
4.4.40.0000.0334.71
4.4.30.0030.0174.75
4.4.20.0010.0184.84
4.4.10.0000.0254.85
4.4.00.0010.0274.76
4.3.110.0040.0164.67
4.3.100.0040.0134.67
4.3.90.0030.0214.63
4.3.80.0040.0304.59
4.3.70.0040.0174.63
4.3.60.0020.0194.63
4.3.50.0010.0184.63
4.3.40.0050.0224.54
4.3.30.0020.0183.30
4.3.20.0030.0253.28
4.3.10.0040.0143.23
4.3.00.0000.01314.28

preferences:
146.45 ms | 1394 KiB | 7 Q