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); }}
Output for git.master, git.master_jit, rfc.property-hooks

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
36.92 ms | 401 KiB | 8 Q