English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
is_float() The function is used to check whether a variable is a floating-point type.
Alias Functions:is_double(), is_real().
Note: To test whether a variable is a number or a numeric string (such as form input, which is usually a string), you must use is_numeric().
PHP Version Requirement: PHP 4, PHP 5, PHP 7
bool is_float ( mixed $var )
Parameter Description:
If the specified variable is float, it returns TRUE; otherwise, it returns FALSE.
<?php $var_name=127.55; if (is_float($var_name)) echo 'This is a floating-point value' . PHP_EOL; else echo 'This is not a floating-point value' . PHP_EOL; var_dump(is_float('w3codebox echo PHP_EOL; var_dump(is_float(85)); echo PHP_EOL; var_dump(is_float(true)); echo PHP_EOL; var_dump(is_float(array(23.3, 56, 6); ?>
The output result is:
This is a floating-point value bool(false) bool(false) bool(false) bool(false)