PHP is_finite()

ElMurimi's avatar
Published Jul 29, 2023
Contribute to Docs

The is_finite() function evaluates whether the passed value is finite or not and returns a boolean value.

  • Looking for an introduction to the theory behind programming? Master Python while learning data structures, algorithms, and more!
    • Includes 6 Courses
    • With Professional Certification
    • Beginner Friendly.
      75 hours

Syntax

$result = is_finite($value);

Returns 1 (true) if the $value is finite, nothing (false) otherwise.

Example

The example below demonstrates the use of the is_finite() function to check whether a number is finite or not.

<?php
$result = is_finite(100);
echo $result;
?>

This will result in the following output:

1

Codebyte Example

The codebyte below uses the is_finite() function on a pair of values to evaluate whether they are finite:

Code
Output

All contributors

Contribute to Docs

Learn PHP on Codecademy

  • Looking for an introduction to the theory behind programming? Master Python while learning data structures, algorithms, and more!
    • Includes 6 Courses
    • With Professional Certification
    • Beginner Friendly.
      75 hours