PHP is_finite() Function

In this chapter you will learn:

  1. Definition for PHP is_finite() Function
  2. Syntax for PHP is_finite() Function
  3. Parameter for PHP is_finite() Function
  4. Return for PHP is_finite() Function
  5. Example - Check whether a value is finite or not

Definition

The is_finite() function checks whether a value is finite or not.

Syntax

PHP is_finite() Function has the following syntax.

is_finite(value);

Parameter

ParameterIs Required Description
valueRequired.Value to check

Return

Item Description
Return Value TRUE if value is a finite number, FALSE otherwise
Return Type Boolean

This function returns true (1) if the specified value is a finite number which is within the allowed range for a PHP float on this platform, otherwise it returns false/nothing.

Example

Check whether a value is finite or not:


<?php/*from jav a  2s . c om*/
echo is_finite(2) . "\n";
echo is_finite(log(0)) . "\n";
echo is_finite(2000);
?>

The code above generates the following result.

Next chapter...

What you will learn in the next chapter:

  1. Definition for PHP is_infinite() Function
  2. Syntax for PHP is_infinite() Function
  3. Parameter for PHP is_infinite() Function
  4. Return for PHP is_infinite() Function
  5. Example - Check whether a value is infinite or not