note 55615 deleted from function.is-numeric by crell
| From: | crell@php.net | Date: | Mon, 18 Apr 2022 14:58:08 +0000 |
| Subject: | note 55615 deleted from function.is-numeric by crell | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-218283@lists.php.net to get a copy of this message | ||
Note Submitter: jamespam at hotmail dot com
----
Here's a function to determine if a variable represents a whole number:
function is_whole_number($var){
return (is_numeric($var)&&(intval($var)==floatval($var)));
}
just simple stuff...
is_whole_number(2.00000000001); will return false
is_whole_number(2.00000000000); will return true