note 86201 added to function.is-numeric
| From: | jbezorg at gmail dot com | Date: | Tue, 07 Oct 2008 22:19:20 +0000 |
| Subject: | note 86201 added to function.is-numeric | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-145143@lists.php.net to get a copy of this message | ||
Problem with vezquex at gmail dot com's function is it will produce 211st 212nd & 213rd
when it should follow the same pattern of x11th, x12th and x13th.
function number_suffix2($n)
{
$s = array( 'st' , 'nd' , 'rd' );
$e = (int) substr( $n , -2 );
$x = $n % 10 - 1;
return $n.( (array_key_exists( $x , $s ) && ( $e < 10 || $e > 13 ) ) ? $s[$x] :
'th' );
}
----
Server IP: 208.69.120.35
Probable Submitter: 148.129.71.53
----
Manual Page -- http://www.php.net/manual/en/function.is-numeric.php
Edit -- https://master.php.net/note/edit/86201
Del: integrated -- https://master.php.net/note/delete/86201/integrated
Del: useless -- https://master.php.net/note/delete/86201/useless
Del: bad code -- https://master.php.net/note/delete/86201/bad+code
Del: spam -- https://master.php.net/note/delete/86201/spam
Del: non-english -- https://master.php.net/note/delete/86201/non-english
Del: in docs -- https://master.php.net/note/delete/86201/in+docs
Del: other reasons-- https://master.php.net/note/delete/86201
Reject -- https://master.php.net/note/reject/86201
Search -- https://master.php.net/manage/user-notes.php