Skip to content

Instantly share code, notes, and snippets.

View BigManatee's full-sized avatar
:shipit:

Tyler J BigManatee

:shipit:
  • Unfortunately, The UK
  • 13:45 (UTC +01:00)
View GitHub Profile
@BigManatee
BigManatee / ordinal.php
Last active August 29, 2015 14:06 — forked from mnpenner/ordinal.php
Add st, nd, rd, th to a Number
function ordinal($number) {
$ends = array('th','st','nd','rd','th','th','th','th','th','th');
$mod100 = $number % 100;
return $number . ($mod100 >= 11 && $mod100 <= 13 ? 'th' : $ends[$number % 10]);
}