note 107917 deleted from function.is-float by nikic
| From: | nikic@php.net | Date: | Thu, 23 Aug 2012 12:07:34 +0000 |
| Subject: | note 107917 deleted from function.is-float by nikic | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-190190@lists.php.net to get a copy of this message | ||
Note Submitter: ircadhikari at gmail dot com
----
The final version of function to check the actual float value based on previous Kenaniah's
version.
<?php
public function isTrueFloat($val){
if( is_float($val) || ( (float) $val > (int) $val || strlen($val) != strlen( (int) $val) )
&& (ceil($val)) != 0 ) return true;
else return false;
}
?>
<?php
//Tests
'4.0' returns true
'2.1' returns true
0 returns false
"0" returns false
3. returns true
13 returns false
"12" returns false
3.53 returns true
// Additional Tested ones
"0.27" returns true
0.24 returns true
?>