PHP Function Reference

PHP is_infinite() Function



The PHP is_infinite() function is used to check if the argument is infinite or not. It returns true (1) if the argument is infinite (positive or negative), else returns false/nothing.

Syntax

is_infinite(x)   

Parameters

x Required. Specify the value.

Return Value

Returns true (1) if the argument is infinite, else returns false/nothing.

Example:

In the example below, is_infinite() function is used to check if the argument is infinite.

<?php
echo var_dump(is_infinite(10));
echo var_dump(is_infinite(-10));
echo var_dump(is_infinite(log(0)));

echo "\n"; 
echo var_dump(is_infinite(INF));
echo var_dump(is_infinite(-INF));
echo var_dump(is_infinite(NAN));
?>

The output of the above code will be:

bool(false)
bool(false)
bool(true)

bool(true)
bool(true)
bool(false)

❮ PHP Math Reference