Created
February 11, 2013 22:11
-
-
Save macik/4758083 to your computer and use it in GitHub Desktop.
Short arabic2roman conveter
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function rome($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; | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Tried it and while it seems to work it fills my logfile with
and the line it points to is
for($o=$N%$a,$N=$N/$a^0;$o--;$s=$c[$o>2?$b+$N-($N&=-2)+$o=1:$b].$s);
I'm guessing $c[] is the issue, it need some value in there.