note 86201 deleted from function.is-numeric by felipe

[email protected]
Newsgroups php.notes
Message-ID <[email protected]>
Note Submitter: jbezorg at gmail dot com 

----

Problem with vezquex at gmail dot com's function is it will produce 211th 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' );
}
?>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.