PHP Tutorial PHP Advanced PHP Resources
Python Java C++ C C# PHP R SQL DS Algo InterviewQ

PHP - Math is_finite() Function



The PHP Math is_finite() function is used to check if the argument is a finite value or not. It returns true (1) if the argument is finite, else returns false/nothing.

Syntax

is_finite(x)   

Parameters

x Required. Specify the value.

Return Value

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

Example:

In the example below, is_finite() function is used to check if the argument is finite.

<?php
echo var_dump(is_finite(2));
echo var_dump(is_finite(-2));
echo var_dump(is_finite(log(0)));    
?>

The output of the above code will be:

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

❮ PHP Math Functions

5