is_finite() returns true when a floating-point value is neither infinite nor NAN.
$value = 25.5;
var_dump(is_finite($value)); // bool(true)
A finite float is neither NAN nor positive/negative infinity.
var_dump(is_finite(2.0)); // bool(true)
var_dump(is_finite(0.5)); // bool(true)
var_dump(is_finite(log(0))); // bool(false): -INF
var_dump(is_finite(sqrt(-1))); // bool(false): NAN
Syntax
bool is_finite(float $num)
| Parameter | DESCRIPTION |
|---|---|
$input | Required : Number to check. |
Returns true when $num is finite; otherwise returns false.
Author & Instructor at plus2net
I write and maintain practical tutorials on Python, PHP, SQL, JavaScript, HTML, jQuery, and web development at plus2net. The tutorials focus on clear explanations, working examples, and code that readers can test and adapt while learning.