note 86203 deleted from function.is-numeric by cmb
| From: | cmb@php.net | Date: | Sun, 23 Jun 2019 10:39:12 +0000 |
| Subject: | note 86203 deleted from function.is-numeric by cmb | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-211355@lists.php.net to get a copy of this message | ||
Note Submitter: jbezorg at gmail dot com
----
"$e = (int) substr( $n , -2 );"
What the heck am I thinking.
<?php
function number_suffix2($n)
{
$s = array( 1->'st' , 2=>'nd' , 3=>'rd' );
$e = $n % 100;
$x = $n % 10;
return $n.( ( $x > 0 && $x < 4 && ( $e < 11 || $e > 13 ) ) ? $s[$x]
: 'th' );
}
?>