By using this function, we can check that the input value is float or not. This function was introduced in PHP 4.0.
bool is_float ( mixed $var )
Parameter | Description | Is compulsory |
---|---|---|
var | The variable being evaluated. | compulsory |
The is_float() function returns TRUE if the var_name is float, otherwise false.
<?php $x=123.41; echo is_float($x); ?>
Output:
<?php $a=123.41; $b=12; var_dump (is_float($a)); var_dump (is_float($b)); ?>
Output:
<?php $var_name=126.56; if (is_float($var_name)) echo 'This is a float value.<br>'; else echo 'This is not a float value.<br>'; var_dump(is_float('rookienerd')); echo '<br>'; var_dump(is_float(85)); ?>
Output:
It is a configuration setting in php.ini used to specify a total number of digits displayed in floating point number.