A McGraw Hill Book Plug-in PHP: 100 Power Solutions
By Robin Nixon (McGraw Hill 2010, ISBN 978-0071666596)

Home | About | Buy It | Download | Contact

Select Chapter: 1  2  3  4  5  6  7  8  9 10 11 12

Chapter 3: Plug-in 6 - Count Tail

Displaying a date in the format "23 November" or "March 12" isn't really that friendly and you may wish to use the better flowing "23rd November" and "March 12th". In fact there are many places where you use numbers and they would look better displayed with one of 'st', 'nd', 'rd' or 'th' following, such as in the sentence "You're our 124,362nd" visitor, rather than "You are visitor 124,362", and so on.

The Figure shows using this plug-in to add the correct suffix to all the numbers between 0 and 100.