is_infinite() checks whether a floating-point result represents positive or negative infinity.
$value = INF;
var_dump(is_infinite($value)); // bool(true)
Use is_infinite() when a calculation may overflow to INF or -INF.
var_dump(is_infinite(2.0)); // bool(false)
var_dump(is_infinite(INF)); // bool(true)
var_dump(is_infinite(-INF)); // bool(true)
var_dump(is_infinite(log(0))); // bool(true)
Syntax
bool is_infinite(float $num)
| Parameter | DESCRIPTION |
|---|---|
$input | Required : Number to check. |
Returns true only for INF or -INF; finite values and NAN return 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.