note 68429 added to ref.math

From: Date: Wed, 26 Jul 2006 18:42:56 +0000
Subject: note 68429 added to ref.math
Groups: php.notes 
Request: Send a blank email to php-notes+get-115224@lists.php.net to get a copy of this message
A slightly more complex but much more accurate cardinal=>ordinal function (the one below doesn't account for 11th, 12th, and 13th, which don't follow the usual rules): <?php function ordinal($cardinal) { $cardinal = (int)$cardinal; $digit = substr($cardinal, -1, 1); $tens = substr($cardinal, -2, 1); if($tens == 1) { return $cardinal.'th'; } switch($digit) { case 1: return $cardinal.'st'; case 2: return $cardinal.'nd'; case 3: return $cardinal.'rd'; default: return $cardinal.'th'; } } ?> ---- Server IP: 216.194.113.175 Probable Submitter: 69.245.44.22 ---- X-Spam-Status: No, hits=3.1 required=5.0 tests=DATE_MISSING,FROM_NO_LOWER autolearn=no version=2.64 ---- Manual Page -- http://www.php.net/manual/en/ref.math.php Edit -- http://master.php.net/note/edit/68429 Del: integrated -- http://master.php.net/note/delete/68429/integrated Del: useless -- http://master.php.net/note/delete/68429/useless Del: bad code -- http://master.php.net/note/delete/68429/bad+code Del: spam -- http://master.php.net/note/delete/68429/spam Del: non-english -- http://master.php.net/note/delete/68429/non-english Del: in docs -- http://master.php.net/note/delete/68429/in+docs Del: other reasons-- http://master.php.net/note/delete/68429 Reject -- http://master.php.net/note/reject/68429 Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#115224) next »