PHP Human Number Function
December 5, 2010| Tweet |
1
15
23
1234
12345678
15
23
1234
12345678
To This:
1st
15th
23rd
1,234th
12,345,678th
15th
23rd
1,234th
12,345,678th
Download Original
<?PHP function humanNumber($number=0) { CASE 1: $number .= "st"; break; CASE 2: $number .= "nd"; break; CASE 3: $number .= "rd"; break; DEFAULT: $number .= "th"; break; } } RETURN $number; } echo humanNumber(1) . "<br />" . humanNumber(15) . "<br />" . humanNumber(23) . "<br />" . humanNumber(1234) . "<br />" . humanNumber("12345678");
Because this function is so darn easy to make and use, you can use it for whatever you want, just don't copyright it on me (really, is this worth the $275 to do so???). No comments yet! Be the first!

Facebook
LinkedIn