The only problem I can see with this is that the return will then be cast as a string, not an integer - so if you want to increment the number down the line you'd need to pass the original value - we've now got two variables $original_num and $ordinal_num, or the need to always call ordinal() on-the-fly, which might get a bit confusing, especially if you're a retard like me :)

Also handling real number arguments is a bit of a problem, since ordinal(3.1412) -> '3.1412nd' , lol! Obviously you could grep the decimal point and either call die/exit or force an exception, but that's a bit extreme. A better solution overall would be to use a well-known tightly-typed language and extend the relevant Number class. But we all know Pete hates Java, hohoho.

Joe ;)

CAPTCHA