is_infinite

(PHP 4 >= 4.2.0, PHP 5, PHP 7, PHP 8)

is_infiniteChecks whether a float is infinite

Description

is_infinite(float $num): bool

Returns whether the given num is either INF or -INF.

Parameters

num

The float to check

Return Values

true if num is either INF or -INF, else false.

Examples

Example #1 is_infinite() example

<?php
$inf
= 1e308 * 2;

var_dump($inf, is_infinite($inf));

$negative_inf = -$inf;

var_dump($negative_inf, is_infinite($negative_inf));
?>

The above example will output:

float(INF)
bool(true)
float(-INF)
bool(true)

See Also

add a note

User Contributed Notes

There are no user contributed notes for this page.
To Top

Follow Lee on X/Twitter - Father, Husband, Serial builder creating AI, crypto, games & web tools. We are friends :) AI Will Come To Life!

Check out: eBank.nz (Art Generator) | Netwrck.com (AI Tools) | Text-Generator.io (AI API) | BitBank.nz (Crypto AI) | ReadingTime (Kids Reading) | RewordGame | BigMultiplayerChess | WebFiddle | How.nz | Helix AI Assistant