3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php function roman_number($N) { $c = 'IVXLCDM'; for ($a = 5, $b = $s = ''; $N; $b++, $a ^= 7) for ($o = $N % $a, $N = $N / $a ^ 0; $o--; $s = $c[$o > 2 ? $b + $N - ($N &= -2) + $o = 1 : $b] . $s) ; return $s; } echo roman_number(542);
Output for 5.4.0 - 5.6.28, 7.0.0 - 7.1.0
Warning: Illegal string offset '' in /in/rpWdu on line 6 Warning: Illegal string offset '' in /in/rpWdu on line 6 DXLII
Output for 4.3.0 - 5.3.29, hhvm-3.10.0 - 3.12.0
DXLII