PHP is_infinite() Function – Determine if a Value Is Infinite

The article explains PHP’s is_infinite() function, describing its purpose of detecting infinite floating‑point values, detailing its single parameter, return values, and providing example code that demonstrates true and false outcomes, with the expected output shown.

Laravel Tech Community
Laravel Tech Community
Laravel Tech Community
PHP is_infinite() Function – Determine if a Value Is Infinite

The is_infinite() function in PHP checks whether a given floating‑point value is infinite (positive or negative). If the value exceeds the platform’s floating‑point range, such as the result of log(0), the function returns TRUE; otherwise it returns FALSE.

Parameter: val – The value to be examined.

Return value: TRUE if val is infinite. FALSE otherwise.

Example:

<?php
echo is_infinite(2);          // false, outputs 0
echo is_infinite(log(0));    // true, outputs 1
echo is_infinite(2000);      // false, outputs 0
?>

Output:

1
Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

BackendPHPfunctioninfiniteis_infinite
Laravel Tech Community
Written by

Laravel Tech Community

Specializing in Laravel development, we continuously publish fresh content and grow alongside the elegant, stable Laravel framework.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.