PHP is_float Function

PHP is_float Function

ᴰᵒᵖᵖᵉˡᵍᵃⁿᵍᵉʳ 多佩尔甘格尔

By using this function, we can check that the input value is float or not. This function was introduced in PHP 4.0.

 

Syntax

bool is_float ( mixed $var )  

 

Parameters


Return type:

The is_float() function returns TRUE if the var_name is float, otherwise false.

 

Example 1

<?php  
    $x=123.41;  
    echo is_float($x);  
?>  

 Output:


Example 2

<?php  
    $a=123.41;  
    $b=12;  
    var_dump (is_float($a));  
    var_dump (is_float($b));  
?>  

 Output:


Example 3

<?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('skyapper'));  
    echo '<br>';  
    var_dump(is_float(85));  
?>  

 

Precision::

It is a configuration setting in php.ini used to specify a total number of digits displayed in floating point number.

 

Here it is:


Report Page