note 70775 deleted from ref.math by cmb
| From: | cmb@php.net | Date: | Sun, 21 Jul 2019 08:57:43 +0000 |
| Subject: | note 70775 deleted from ref.math by cmb | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-211656@lists.php.net to get a copy of this message | ||
Note Submitter: tim at durge dot org
----
In Evan's ordinal function, the line:
<?php
$tens = substr($cardinal, -2, 1);
?>
needs to be replaced by:
<?php
$tens = round($cardinal/10);
?>
or similar. At least on PHP 4.3.10, substr("1", -2, 1) returns '1' - so
Evan's function gives "1th", as well as "11th". This is contrary to the
documentation, but is noted in the comments on the substr manual page.