3v4l.org

run code in 300+ PHP versions simultaneously
<?php function ConverToRoman(int $n){ $romanNumber_Array = array( 'M' => 1000, 'CM' => 900, 'D' => 500, 'CD' => 400, 'C' => 100, 'XC' => 90, 'L' => 50, 'XL' => 40, 'X' => 10, 'IX' => 9, 'V' => 5, 'IV' => 4, 'I' => 1); $res = ''; foreach ($romanNumber_Array as $roman => $number) { $res .= str_repeat($roman, (int) ($n / $number)); $n %= $number; } return $res; } echo ConverToRoman(3333); echo "\n---\n"; echo ConverToRoman(5000);
Output for git.master, git.master_jit, rfc.property-hooks
MMMCCCXXXIII --- MMMMM

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:
34.65 ms | 405 KiB | 5 Q