note 30994 added to function.date
| From: | php-general at lists dot php dot net | Date: | Sat, 05 Apr 2003 18:20:28 +0000 |
| Subject: | note 30994 added to function.date | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-46265@lists.php.net to get a copy of this message | ||
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
--
http://www.php.net/manual/en/function.date.php
http://master.php.net/manage/user-notes.php?action=edit+30994
http://master.php.net/manage/user-notes.php?action=delete+30994
http://master.php.net/manage/user-notes.php?action=reject+30994