NYCPHP Meetup

NYPHP.org

[nycphp-talk] int to ordinal function

Michael Sims jellicle at gmail.com
Thu Oct 6 12:08:37 EDT 2005


Does anyone have a function handy for converting numerals to the 
fully-alphabetic ordinal equivalent?

f(1) = "First"
f(2) = "Second"
f(3) = "Third"
f(24) = "Twenty-fourth"
etc.

It's easier to convert to the numeric ordinal (1st, 2nd, 3rd) but I prefer 
the all-alphabetic, especially if I don't have to write it myself.  :)

Michael Sims



More information about the talk mailing list