note 103537 added to ref.math

From: Date: Tue, 19 Apr 2011 04:40:55 +0000
Subject: note 103537 added to ref.math
Groups: php.notes 
Request: Send a blank email to php-notes+get-178964@lists.php.net to get a copy of this message
Here's a simple way way to convert a number to an ordinal number I created: $i == the number to convert. Put this inside a for loop if you need to populate an array. // change increment variable to ordinal number. $n1 = $i % 100; //first remove all but the last two digits $n2 = ($n1 < 20 ? $1 : $i % 10; //remove all but last digit unless the number is in the teens, which all should be 'th' //$n is now used to determine the suffix. $ord = ($n2==1 ? $i.'st' : ( ($n2==2 ? $i.'nd' : ($n2==3 ? $i.'rd' : $i.'th') ) ) ) ---- Server IP: 69.147.83.197 Probable Submitter: 208.95.51.254 ---- Manual Page -- http://www.php.net/manual/en/ref.math.php Edit -- https://master.php.net/note/edit/103537 Del: integrated -- https://master.php.net/note/delete/103537/integrated Del: useless -- https://master.php.net/note/delete/103537/useless Del: bad code -- https://master.php.net/note/delete/103537/bad+code Del: spam -- https://master.php.net/note/delete/103537/spam Del: non-english -- https://master.php.net/note/delete/103537/non-english Del: in docs -- https://master.php.net/note/delete/103537/in+docs Del: other reasons-- https://master.php.net/note/delete/103537 Reject -- https://master.php.net/note/reject/103537 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#178964) next »