PHP 1st, 2nd, 3rd, 4th, 5th, 6th – PHP Add Ordinal Number Suffix

This is simple function to add English ordinal number suffix after normal number. Function takes number as a parameter and returns number with suffix, like:
1st, 2nd, 3rd, 4th, 5th, 6th…

This is example table of ordinal numbers 1 to 100

Add Ordinal Suffix PHP Function

Add Ordinal Suffix PHP Function Usage/Testing

Output:

Share this post

22 Comments

  1. Did the job for me – exactly what I was looking for. Thanks guys

    Reply
  2. Thanks you, it’s really good

    Reply

Submit a Comment

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">