note 114388 added to function.is-numeric
| From: | JorisBerthelot | Date: | Fri, 14 Feb 2014 11:30:36 +0000 |
| Subject: | note 114388 added to function.is-numeric | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-198511@lists.php.net to get a copy of this message | ||
There's no way to check if a string contains a float number so here's a tricky one:
<?php
function isFloat($input)
{
return is_numeric(preg_replace('/[^-0-9\.]/', null, $input));
}
----
Server IP: 195.221.21.36
Probable Submitter: 109.190.81.106
----
Manual Page -- http://php.net/manual/en/function.is-numeric.php
Edit -- https://master.php.net/note/edit/114388
Del: integrated -- https://master.php.net/note/delete/114388/integrated
Del: useless -- https://master.php.net/note/delete/114388/useless
Del: bad code -- https://master.php.net/note/delete/114388/bad+code
Del: spam -- https://master.php.net/note/delete/114388/spam
Del: non-english -- https://master.php.net/note/delete/114388/non-english
Del: in docs -- https://master.php.net/note/delete/114388/in+docs
Del: other reasons-- https://master.php.net/note/delete/114388
Reject -- https://master.php.net/note/reject/114388
Search -- https://master.php.net/manage/user-notes.php