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 ($j=0;$j<10;$j++){ 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.60.0070.02116.36
8.3.50.0080.02422.01
8.3.40.0100.01618.81
8.3.30.0100.01719.04
8.3.20.0080.00620.34
8.3.10.0040.01120.52
8.3.00.0060.00919.50
8.2.180.0030.02416.50
8.2.170.0030.02722.96
8.2.160.0130.01320.34
8.2.150.0040.01224.18
8.2.140.0060.00824.66
8.2.130.0030.01026.16
8.2.120.0030.01020.97
8.2.110.0030.02020.52
8.2.100.0100.01318.22
8.2.90.0060.01619.25
8.2.80.0030.01517.97
8.2.70.0030.01517.50
8.2.60.0030.01618.04
8.2.50.0040.01518.07
8.2.40.0130.01018.16
8.2.30.0000.01719.57
8.2.20.0030.01517.69
8.2.10.0000.01818.07
8.2.00.0070.01117.69
8.1.280.0030.02425.92
8.1.270.0090.00623.91
8.1.260.0060.01226.35
8.1.250.0040.01128.09
8.1.240.0030.02023.83
8.1.230.0040.01919.02
8.1.220.0060.01217.77
8.1.210.0030.01518.77
8.1.200.0070.01417.23
8.1.190.0040.01517.23
8.1.180.0000.01818.10
8.1.170.0040.01618.50
8.1.160.0000.01722.02
8.1.150.0090.00918.85
8.1.140.0070.01117.54
8.1.130.0030.01317.79
8.1.120.0060.01217.57
8.1.110.0060.01217.54
8.1.100.0060.01217.52
8.1.90.0030.01417.51
8.1.80.0030.01317.38
8.1.70.0000.01617.48
8.1.60.0000.02417.62
8.1.50.0040.01817.65
8.1.40.0060.01617.52
8.1.30.0100.01317.61
8.1.20.0000.02217.70
8.1.10.0030.01917.53
8.1.00.0030.01917.63
8.0.300.0040.01418.77
8.0.290.0060.01216.75
8.0.280.0060.01218.40
8.0.270.0030.01617.35
8.0.260.0070.01117.32
8.0.250.0030.01516.95
8.0.240.0000.01816.90
8.0.230.0030.01617.02
8.0.220.0000.01816.86
8.0.210.0060.01216.93
8.0.200.0000.01717.09
8.0.190.0040.01816.98
8.0.180.0030.01916.97
8.0.170.0070.01617.03
8.0.160.0070.01716.97
8.0.150.0040.01816.82
8.0.140.0000.02116.91
8.0.130.0000.02013.42
8.0.120.0000.02216.95
8.0.110.0070.01417.01
8.0.100.0000.02116.90
8.0.90.0060.01616.89
8.0.80.0100.02616.90
8.0.70.0030.01916.77
8.0.60.0000.02216.81
8.0.50.0040.01816.98
8.0.30.0150.03116.92
8.0.20.0110.02917.40
8.0.10.0000.02117.01
8.0.00.0080.02816.61
7.4.330.0040.01115.03
7.4.320.0030.01216.57
7.4.300.0040.01216.58
7.4.290.0000.02116.58
7.4.280.0030.01916.63
7.4.270.0030.01716.48
7.4.260.0000.02016.69
7.4.250.0090.01216.45
7.4.240.0000.02016.57
7.4.230.0030.01816.47
7.4.220.0120.02816.77
7.4.210.0100.03416.54
7.4.200.0000.02116.64
7.4.160.0100.02416.53
7.4.150.0130.03917.40
7.4.140.0080.02917.86
7.4.130.0090.02716.54
7.4.120.0120.02516.59
7.4.110.0090.02716.77
7.4.100.0120.03516.68
7.4.90.0100.02416.61
7.4.80.0120.04319.39
7.4.70.0100.03916.72
7.4.60.0130.02316.53
7.4.50.0030.02616.38
7.4.40.0120.02716.55
7.4.30.0070.04316.72
7.4.10.0030.04315.21
7.4.00.0070.03414.97
7.3.330.0000.02313.41
7.3.320.0030.01713.26
7.3.310.0000.02116.42
7.3.300.0040.01816.40
7.3.290.0090.02516.38
7.3.280.0130.02616.40
7.3.270.0070.04017.40
7.3.260.0160.02216.60
7.3.250.0100.02816.43
7.3.240.0110.02816.43
7.3.230.0120.02516.40
7.3.210.0100.02916.43
7.3.200.0130.02619.39
7.3.190.0070.03116.73
7.3.180.0100.02416.39
7.3.170.0090.02716.41
7.3.160.0160.01916.40
7.3.130.0100.04014.79
7.3.120.0000.03415.06
7.3.110.0060.03915.00
7.3.100.0030.03414.57
7.3.90.0000.03214.70
7.3.80.0030.04014.89
7.3.70.0030.03214.59
7.3.60.0090.02514.93
7.3.50.0090.02514.66
7.3.40.0000.03114.98
7.3.30.0000.03614.84
7.3.20.0030.03816.87
7.3.10.0030.03016.60
7.3.00.0050.02716.71
7.2.330.0160.02616.76
7.2.320.0100.04916.81
7.2.310.0100.02916.83
7.2.300.0070.03416.44
7.2.290.0060.05616.55
7.2.260.0070.04615.03
7.2.250.0100.04214.70
7.2.240.0070.02814.84
7.2.230.0070.04615.21
7.2.220.0100.04215.28
7.2.210.0030.03114.85
7.2.200.0000.03714.87
7.2.190.0070.03215.20
7.2.180.0100.02915.12
7.2.170.0000.03915.31
7.2.160.0100.03315.20
7.2.150.0060.02616.99
7.2.140.0030.03016.75
7.2.130.0050.03616.90
7.2.120.0130.03416.85
7.2.110.0050.03416.74
7.2.100.0000.04116.93
7.2.90.0080.03816.88
7.2.80.0030.03416.76
7.2.70.0060.03116.70
7.2.60.0090.02716.77
7.2.50.0100.03516.75
7.2.40.0100.03816.92
7.2.30.0100.03016.86
7.2.20.0080.03916.86
7.2.10.0030.03816.69
7.2.00.0070.03117.61
7.1.330.0030.04515.90
7.1.320.0030.05415.46
7.1.310.0060.04115.84
7.1.300.0000.04315.45
7.1.290.0030.04115.59
7.1.280.0060.04215.68
7.1.270.0060.04215.67
7.1.260.0030.04115.83
7.1.250.0120.03915.47
7.1.240.0030.04715.79
7.1.230.0030.03615.89
7.1.220.0030.03816.04
7.1.210.0060.03515.88
7.1.200.0050.02915.64
7.1.190.0030.04115.55
7.1.180.0060.03515.80
7.1.170.0070.03915.94
7.1.160.0090.03815.86
7.1.150.0100.03315.91
7.1.140.0000.04415.64
7.1.130.0060.05115.66
7.1.120.0030.04315.90
7.1.110.0030.03715.94
7.1.100.0020.03617.14
7.1.90.0070.05315.68
7.1.80.0100.05115.74
7.1.70.0110.03116.44
7.1.60.0130.03617.65
7.1.50.0130.04025.23
7.1.40.0070.05015.76
7.1.30.0000.04415.73
7.1.20.0060.03515.54
7.1.10.0030.03815.77
7.1.00.0030.06819.04
7.0.330.0000.05515.52
7.0.320.0000.03915.57
7.0.310.0060.03215.66
7.0.300.0030.04415.48
7.0.290.0070.03815.18
7.0.280.0100.03415.36
7.0.270.0070.03915.47
7.0.260.0060.04215.19
7.0.250.0030.04215.65
7.0.240.0070.04315.59
7.0.230.0100.03515.48
7.0.220.0070.03915.36
7.0.210.0030.04115.24
7.0.200.0100.03415.90
7.0.190.0030.04115.38
7.0.180.0030.04215.41
7.0.170.0100.04015.63
7.0.160.0030.04115.27
7.0.150.0070.03515.31
7.0.140.0080.06418.72
7.0.130.0030.04115.37
7.0.120.0070.04015.24
7.0.110.0030.03815.52
7.0.100.0070.04015.25
7.0.90.0000.04815.54
7.0.80.0070.03315.35
7.0.70.0000.04315.53
7.0.60.0100.04917.74
7.0.50.0100.07216.70
7.0.40.0080.06916.91
7.0.30.0180.06216.74
7.0.20.0130.05416.72
7.0.10.0100.07716.73
7.0.00.0030.05116.96
5.6.400.0060.06114.64
5.6.390.0070.07614.80
5.6.380.0070.06014.45
5.6.370.0070.06314.23
5.6.360.0000.06514.45
5.6.350.0100.06514.46
5.6.340.0030.06214.41
5.6.330.0030.06414.57
5.6.320.0070.06014.61
5.6.310.0030.06614.79
5.6.300.0000.06514.25
5.6.290.0060.05414.57
5.6.280.0070.08817.89
5.6.270.0030.07414.57
5.6.260.0070.06214.53
5.6.250.0070.06414.59
5.6.240.0070.07014.46
5.6.230.0060.06214.38
5.6.220.0030.06114.54
5.6.210.0050.09217.55
5.6.200.0100.09916.26
5.6.190.0020.08717.35
5.6.180.0250.08717.30
5.6.170.0130.06917.40
5.6.160.0020.06817.33
5.6.150.0020.08816.17
5.6.140.0030.06616.46
5.6.130.0050.08116.27
5.6.120.0050.07717.71
5.6.110.0050.08917.87
5.6.100.0020.08517.75
5.6.90.0070.06417.56
5.6.80.0070.08817.40
5.6.70.0030.06514.31
5.6.60.0030.06514.25
5.6.50.0030.08014.04
5.6.40.0030.05814.31
5.6.30.0030.06314.23
5.6.20.0100.05514.52
5.6.10.0030.06214.39
5.6.00.0000.06114.26
5.5.380.0030.05914.36
5.5.370.0030.06614.44
5.5.360.0030.06114.28
5.5.350.0150.07917.37
5.5.340.0050.09616.08
5.5.330.0130.08517.31
5.5.320.0050.09617.46
5.5.310.0120.07417.45
5.5.300.0070.08816.20
5.5.290.0070.06616.18
5.5.280.0030.09217.66
5.5.270.0070.08717.66
5.5.260.0020.06817.49
5.5.250.0070.07317.34
5.5.240.0130.09617.35
5.5.230.0130.07414.37
5.5.220.0070.07114.00
5.5.210.0070.07914.20
5.5.200.0060.06514.16
5.5.190.0070.06014.67
5.5.180.0100.05914.23
5.5.170.0060.06214.34
5.5.160.0030.06914.13
5.5.150.0000.06414.65
5.5.140.0070.07214.27
5.5.130.0000.08114.18
5.5.120.0030.06414.47
5.5.110.0070.05914.37
5.5.100.0030.08114.45
5.5.90.0030.07714.33
5.5.80.0070.05814.40
5.5.70.0060.06514.28
5.5.60.0030.05814.25
5.5.50.0030.05914.45
5.5.40.0070.08314.13
5.5.30.0070.08314.43
5.5.20.0070.05614.43
5.5.10.0000.06614.08
5.5.00.0000.07513.96
5.4.450.0100.07415.27
5.4.440.0420.06115.18
5.4.430.0480.07915.39
5.4.420.0370.08415.28
5.4.410.0580.07515.21
5.4.400.0480.07315.26
5.4.390.0320.07815.19
5.4.380.0230.09515.00
5.4.370.0170.08514.81
5.4.360.0100.08114.84
5.4.350.0280.08014.72
5.4.340.0170.08215.01
5.4.330.0100.05610.90
5.4.320.0020.06911.88
5.4.310.0030.07811.91
5.4.300.0050.06411.92
5.4.290.0030.07311.75
5.4.280.0080.06311.81
5.4.270.0070.06811.74
5.4.260.0070.06611.63
5.4.250.0070.06211.60
5.4.240.0070.06411.74
5.4.230.0070.06711.69
5.4.220.0050.06511.61
5.4.210.0070.06011.56
5.4.200.0080.07511.79
5.4.190.0050.07111.61
5.4.180.0040.06511.77
5.4.170.0060.06811.66
5.4.160.0050.06611.58
5.4.150.0060.06311.69
5.4.140.0040.06611.61
5.4.130.0040.07111.70
5.4.120.0060.07411.62
5.4.110.0080.06611.57
5.4.100.0050.06511.50
5.4.90.0050.06911.54
5.4.80.0070.06411.46
5.4.70.0040.06511.68
5.4.60.0040.06611.66
5.4.50.0050.06511.58
5.4.40.0040.06711.61
5.4.30.0070.06311.63
5.4.20.0020.07411.55
5.4.10.0060.07511.60
5.4.00.0040.06811.21
5.3.290.0060.04112.80
5.3.280.0050.04312.71
5.3.270.0080.03712.72
5.3.260.0040.04012.72
5.3.250.0060.03712.71
5.3.240.0040.04112.72
5.3.230.0040.04012.71
5.3.220.0050.03712.68
5.3.210.0040.04112.68
5.3.200.0050.03912.68
5.3.190.0070.03912.68
5.3.180.0060.04112.67
5.3.170.0070.03712.67
5.3.160.0050.03812.68
5.3.150.0060.04312.68
5.3.140.0120.03112.66
5.3.130.0040.04012.66
5.3.120.0050.03912.66
5.3.110.0060.03912.66
5.3.100.0070.03812.12
5.3.90.0050.03812.10
5.3.80.0070.03612.09
5.3.70.0060.04612.09
5.3.60.0070.03812.07
5.3.50.0060.04112.02
5.3.40.0030.04112.02
5.3.30.0050.04011.98
5.3.20.0090.03511.75
5.3.10.0070.04311.73
5.3.00.0050.03711.71
5.2.170.0040.0319.21
5.2.160.0050.0289.22
5.2.150.0050.0309.21
5.2.140.0060.0359.21
5.2.130.0070.0279.17
5.2.120.0040.0289.18
5.2.110.0040.0299.18
5.2.100.0060.0269.17
5.2.90.0060.0279.17
5.2.80.0080.0289.17
5.2.70.0120.0309.17
5.2.60.0060.0309.13
5.2.50.0070.0349.10
5.2.40.0050.0289.07
5.2.30.0030.0359.04
5.2.20.0060.0279.04
5.2.10.0040.0288.94
5.2.00.0040.0298.80
5.1.60.0080.0228.09
5.1.50.0020.0328.09
5.1.40.0050.0268.06
5.1.30.0070.0318.41
5.1.20.0040.0278.43
5.1.10.0050.0258.16
5.1.00.0030.0278.17
5.0.50.0020.0226.64
5.0.40.0030.0206.50
5.0.30.0040.0306.31
5.0.20.0030.0196.27
5.0.10.0050.0216.26
5.0.00.0040.0286.25
4.4.90.0030.0154.78
4.4.80.0020.0204.76
4.4.70.0030.0164.75
4.4.60.0040.0184.75
4.4.50.0040.0154.77
4.4.40.0030.0364.71
4.4.30.0030.0154.76
4.4.20.0030.0164.84
4.4.10.0050.0144.85
4.4.00.0020.0264.76
4.3.110.0040.0164.67
4.3.100.0040.0184.67
4.3.90.0050.0154.63
4.3.80.0010.0284.58
4.3.70.0040.0174.63
4.3.60.0020.0184.63
4.3.50.0030.0174.63
4.3.40.0020.0274.54
4.3.30.0010.0183.30
4.3.20.0030.0193.28
4.3.10.0010.0183.24
4.3.00.0070.01314.28

preferences:
62.9 ms | 401 KiB | 5 Q