note 79635 added to function.is-float
| From: | nicholas at blasgen dot com | Date: | Thu, 06 Dec 2007 06:52:07 +0000 |
| Subject: | note 79635 added to function.is-float | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-132877@lists.php.net to get a copy of this message | ||
Sorry, I'm going to adjust my code one more time. Much quicker. All we do is look for a
single decimal place and then numbers on both sides. I guess this only works for type STRING, not
all mixed vars. So mine has it's flaws as well. But I tend to pull from files and files are
all strings.
function better_float_check($float) {
$split = split('\.', $float);
if ( count($split) == 2 ) {
if ( ctype_digit($split[0]) && ctype_digit($split[1]) )
return true;
else
return false;
} else {
return false;
}
}
----
Server IP: 208.69.120.35
Probable Submitter: 71.116.64.139
----
Manual Page -- http://www.php.net/manual/en/function.is-float.php
Edit -- https://master.php.net/note/edit/79635
Del: integrated -- https://master.php.net/note/delete/79635/integrated
Del: useless -- https://master.php.net/note/delete/79635/useless
Del: bad code -- https://master.php.net/note/delete/79635/bad+code
Del: spam -- https://master.php.net/note/delete/79635/spam
Del: non-english -- https://master.php.net/note/delete/79635/non-english
Del: in docs -- https://master.php.net/note/delete/79635/in+docs
Del: other reasons-- https://master.php.net/note/delete/79635
Reject -- https://master.php.net/note/reject/79635
Search -- https://master.php.net/manage/user-notes.php