note 48670 added to function.is-numeric
| From: | drew at zitnay dot com | Date: | Tue, 04 Jan 2005 14:07:55 +0000 |
| Subject: | note 48670 added to function.is-numeric | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-82691@lists.php.net to get a copy of this message | ||
What php at thefriedmans dot net said below about .5 returning false and .0.5 returning true
isn't true, at least not for me on PHP 5.0.0. The program:
<?php
echo (is_numeric('5') ? "true" : "false") . "\n";
echo (is_numeric('5.5') ? "true" : "false") . "\n";
echo (is_numeric('.5') ? "true" : "false") . "\n";
echo (is_numeric('.0.5') ? "true" : "false") . "\n";
?>
yields:
true
true
true
false
Just as I would expect.
Drew
----
Manual Page -- http://www.php.net/manual/en/function.is-numeric.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+48670
Delete -- http://master.php.net/manage/user-notes.php?action=delete+48670&report=yes
Reason: bad code -- http://master.php.net/manage/user-notes.php?action=delete+48670&report=yes&reason=bad+code
Reason: spam -- http://master.php.net/manage/user-notes.php?action=delete+48670&report=yes&reason=spam
Reason: useless example -- http://master.php.net/manage/user-notes.php?action=delete+48670&report=yes&reason=useless+example
Reason: contains commercial links -- http://master.php.net/manage/user-notes.php?action=delete+48670&report=yes&reason=contains+commercial+links
Reason: useless note -- http://master.php.net/manage/user-notes.php?action=delete+48670&report=yes&reason=useless+note
Reject -- http://master.php.net/manage/user-notes.php?action=reject+48670&report=yes
Search -- http://master.php.net/manage/user-notes.php