note 107917 added to function.is-float

From: Date: Wed, 14 Mar 2012 18:22:53 +0000
Subject: note 107917 added to function.is-float
Groups: php.notes 
Request: Send a blank email to php-notes+get-186663@lists.php.net to get a copy of this message
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 ?> ---- Server IP: 69.147.83.197 Probable Submitter: 94.174.241.10 ---- Manual Page -- http://www.php.net/manual/en/function.is-float.php Edit -- https://master.php.net/note/edit/107917 Del: integrated -- https://master.php.net/note/delete/107917/integrated Del: useless -- https://master.php.net/note/delete/107917/useless Del: bad code -- https://master.php.net/note/delete/107917/bad+code Del: spam -- https://master.php.net/note/delete/107917/spam Del: non-english -- https://master.php.net/note/delete/107917/non-english Del: in docs -- https://master.php.net/note/delete/107917/in+docs Del: other reasons-- https://master.php.net/note/delete/107917 Reject -- https://master.php.net/note/reject/107917 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#186663) next »