PHP is_float() Function

❮ PHP Variable Handling Reference

Example

Check whether a variable is of type float or not:

<?php
$a = 32;
echo "a is " . is_float($a) . "<br>";

$b = 0;
echo "b is " . is_float($b) . "<br>";

$c = 32.5;
echo "c is " . is_float($c) . "<br>";

$d = "32";
echo "d is " . is_float($d) . "<br>";

$e = true;
echo "e is " . is_float($e) . "<br>";

$f = "null";
echo "f is " . is_float($f) . "<br>";

$g = 1.e3;
echo "g is " . is_float($g) . "<br>";
?>
Try it Yourself »

Definition and Usage

The is_float() function checks whether a variable is of type float or not.

This function returns true (1) if the variable is of type float, otherwise it returns false.


Syntax

is_float(variable);

Parameter Values

Parameter Description
variable Required. Specifies the variable to check

Technical Details

Return Value: TRUE if variable is a float, FALSE otherwise
Return Type: Boolean
PHP Version: 4.0+

❮ PHP Variable Handling Reference
Copyright 1999-2023 by Refsnes Data. All Rights Reserved.