PHP is_float() Function

PHP is_int() Function
PHP is_double() Function

In this article, you will learn how to check if a variable is of type float or not in PHP. The is_float() function in PHP 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.

what is the syntax of the IS_FLOAT() function in php?

is_float(variable);
ParameterDescription
variableRequired. Specifies the variable to check
PHP is_float() method

examples of the IS_FLOAT() function

Example 1. In this example, we 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>";
?>
PHP is_int() Function
PHP is_double() Function
en English
X
Scroll to Top