# PHP is_infinite() Function

PHPServer Side ProgrammingProgramming

## Definition and Usage

The is_infinite() function returns a boolean value. It checks whether given parameter is an infinnite number and if so the function returns TRUE, otherwise FALSE. A number is treated as infinite if it is beyond acceptable range of float in PHP.

is_infinite ( float $val ) : bool  ## Parameters Sr.NoParameter & Description 1val The value to be verified if infinite or not ## Return Values PHP is_infinite() function returns TRUE if val is outside accepted range of float, otherwise it returns FALSE. ## PHP Version This function is available in PHP versions 4.x, PHP 5.x as well as PHP 7.x. ## Example Live Demo Following example shows that 100 is not an infinite number <?php$val=100;
$ret=is_infinite($val);
if ($ret==TRUE) { echo$val . " is an infinite number". "\n";
} else {
var_dump (is_infinite($val)); ?> ## Output This will produce following result − bool(false) ## Example Live Demo Similarly sqrt(-1) produces NAN and hence is_infinite() function returns false − <?php$val=sqrt(-1);
$ret=is_infinite($val);
if ($ret==TRUE) { echo$val . " is an infinite number". "\n";
} else {
echo \$val . " is not an infinite number". "\n";
}
?>

## Output

This will produce following result −

NAN is not an infinite number
Published on 29-Jun-2020 12:33:58