note 30994 deleted from function.date by sniper
| From: | sniper@php.net | Date: | Sat, 11 Oct 2003 16:53:34 +0000 |
| Subject: | note 30994 deleted from function.date by sniper | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-58287@lists.php.net to get a copy of this message | ||
Note Submitter:
----
This function is also useful for things that don't particularly involve dates. For example,
here is a one-line function that takes a number and adds an ordinal suffix to it (st, nd, rd or th):
function suffixNum($num) {
return $num.date('S', mktime(0, 0, 0, date('m'), substr($num, -1),
date('y')));
}
echo suffixNum(101); // outputs 101st