is_infinite()

Published Jul 20, 2023
Contribute to Docs

The is_infinite() function evaluates whether the value is infinite or not and returns a boolean value.

Syntax

$result = is_infinite(value);

Returns 1 if value is infinite, else returns false.

Example

The example below demonstrates the use of the is_infinite() function to check whether a number is infinite or not.

<?php
$value = log(0);
$result = is_infinite($value);
echo $result;
?>

This example results in the following output:

1

All contributors

Looking to contribute?

Learn PHP on Codecademy