Last active
August 29, 2015 13:56
-
-
Save meadsteve/8917648 to your computer and use it in GitHub Desktop.
Totally legitimate ordinal number creator
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 intToString($int) { | |
$first = 'second'; | |
$second = 'third'; | |
$third = 'forth'; | |
$forth = 'fifth'; | |
$dollarer = function ($count) { return ($count > 1) ? str_repeat('$', min($count - 1, 4)) : str_repeat('$', 5); }; | |
if ($int > 5 && $int < 10) { | |
$dollars = "$$$$$"; | |
$fifth = array('fifth', 'sixth', 'seventh', 'eighth', 'ninth'); | |
goto woo; | |
} | |
else { | |
$dollars = $dollarer($int); | |
$fifth = 'first'; | |
goto ahh; | |
} | |
woo: | |
$array = eval("return " . $dollars . 'first;'); | |
return $array[$int - 5]; | |
ahh: | |
return eval("return " . $dollars . 'first;'); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Good, but I spotted a few issues which I've fixed in my fork.