PHP is_real() Function

P
PHP is_resource() Function
PHP is_numeric() Function

In this article, you will learn how to check if a number is real or not in PHP. The PHP is_real() function checks whether a variable is of type float or not. This function is an alias of is_float().

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

is_real(variable);
ParametersDetails
variableRequired. Specifies the variable to check
PHP IS_REAL() method

examples of the IS_REAL() function

Example 1. In this example, we check whether a variable is of type float or not.

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

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

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

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

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

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

$g = 1.e3;
echo "g is " . is_real($g) . "<br>";
?>
PHP is_resource() Function
PHP is_numeric() Function

Add comment

Tutor Network

Share this

Learn PHP from A to Z