note 81951 deleted from function.round by jani
| From: | jani@php.net | Date: | Thu, 10 Apr 2008 08:46:45 +0000 |
| Subject: | note 81951 deleted from function.round by jani | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-138095@lists.php.net to get a copy of this message | ||
Note Submitter: kjohnson at zootweb dot com
----
Regarding the change of behavior where round now returns certain values in exponential notation,
here's a second way this can bite you.
If you have field validation code like below, this will falsely indicate an error when the consumer
enters one of the "special" values for income, e.g., 1200000, which is returned as
"1.2E+6":
if(!ereg("^[0-9]{1,10}$", round($_POST['income']))) {
$errors .= "<li>Income should be whole dollars only (10 digits max).</li>";
}
Needless to say, not a good user experience.