Display Numbers with Ordinal Suffix with PHP Function
To add English ordinal number suffix after normal number, following php function returns number with proper suffix. e.g. 1st, 2nd, 3rd, 4th, 5th, 6th… For php versions prior to 5.3. use following version. For php 5.3+, using the built in php function and it is even better because works with locale, just provide your locale.