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)
5.4.320.3570.04319.06
5.4.310.3670.04019.15
5.4.300.3730.04319.11
5.4.290.4200.03718.97
5.4.280.3570.04019.06
5.4.270.4130.03719.10
5.4.260.4170.04019.26
5.4.250.0030.07719.22
5.4.240.0070.07019.04
5.4.230.4030.04019.05
5.4.220.3830.03719.25
5.4.210.3570.03319.14
5.4.200.3930.03319.22
5.4.190.3870.03018.93
5.4.180.3600.03718.98
5.4.170.3770.03018.92
5.4.160.3870.02719.12
5.4.150.4100.03019.13
5.4.140.4500.03716.35
5.4.130.4670.03016.40
5.4.120.4170.03716.34
5.4.110.3930.03316.55
5.4.100.3800.03316.46
5.4.90.3600.03016.64
5.4.80.4370.03716.50
5.4.70.4030.03316.62
5.4.60.3730.03316.40
5.4.50.3330.03316.19
5.4.40.3830.04016.45
5.4.30.3330.03316.42
5.4.20.3330.03716.23
5.4.10.3570.03716.45
5.4.00.4130.04315.92
5.3.290.4000.03714.66
5.3.280.3870.03314.64
5.3.270.3770.04014.61
5.3.260.3470.04014.61
5.3.250.4200.03014.66
5.3.240.3830.03014.66
5.3.230.4500.04014.74
5.3.220.4230.03014.48
5.3.210.4330.04014.62
5.3.200.4930.03714.58
5.3.190.3630.04014.61
5.3.180.4600.03014.59
5.3.170.4370.03714.57
5.3.160.3900.04314.55
5.3.150.3730.04714.57
5.3.140.3570.04014.56
5.3.130.3430.04714.57
5.3.120.3030.04014.46
5.3.110.3030.03714.59
5.3.100.3300.04013.93
5.3.90.3500.03314.18
5.3.80.3370.03014.08
5.3.70.3530.04014.06
5.3.60.3330.03714.16
5.3.50.3330.03313.88
5.3.40.3570.03713.94
5.3.30.3600.03313.96
5.3.20.4230.03013.74
5.3.10.4470.03713.65
5.3.00.4700.03313.70
5.2.170.2700.03011.14
5.2.160.3030.02711.18
5.2.150.2970.03311.20
5.2.140.2900.03311.29
5.2.130.3300.02011.02
5.2.120.3770.02711.02
5.2.110.3830.02711.16
5.2.100.3800.02311.07
5.2.90.3470.02710.98
5.2.80.3800.02311.10
5.2.70.3230.03011.05
5.2.60.3630.02710.99
5.2.50.3130.03310.96
5.2.40.2630.02710.98
5.2.30.2730.03010.86
5.2.20.2900.02710.95
5.2.10.2630.02310.82
5.2.00.2730.02710.76
5.1.60.2630.0209.96
5.1.50.2500.02310.04
5.1.40.2530.0279.94
5.1.30.3070.02310.34
5.1.20.3170.02710.39
5.1.10.3100.03310.05
5.1.00.2630.02310.06
5.0.50.1300.0178.61
5.0.40.1230.0178.36
5.0.30.1270.0308.37
5.0.20.1500.0238.24
5.0.10.1500.0238.08
5.0.00.1230.0278.07
4.4.90.1700.0136.53
4.4.80.1400.0136.53
4.4.70.1430.0176.53
4.4.60.1200.0136.53
4.4.50.1400.0136.53
4.4.40.1430.0276.53
4.4.30.1430.0176.53
4.4.20.1530.0136.53
4.4.10.1200.0136.53
4.4.00.1470.0306.53
4.3.110.1200.0136.53
4.3.100.1530.0136.53
4.3.90.1230.0176.53
4.3.80.1530.0276.53
4.3.70.1330.0136.53
4.3.60.1300.0176.53
4.3.50.1200.0136.53
4.3.40.1600.0236.53
4.3.30.0600.0176.53
4.3.20.0870.0236.53
4.3.10.0970.0206.53
4.3.00.0870.0206.53

preferences:
143.23 ms | 1394 KiB | 7 Q