PHP Velho Oeste 2024

is_infinite

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

is_infiniteChecks whether a float is infinite

Açıklama

is_infinite(float $num): bool

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

Bağımsız Değişkenler

num

The float to check

Dönen Değerler

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

Örnekler

Örnek 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));
?>

Yukarıdaki örneğin çıktısı:

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

Ayrıca Bakınız

add a note add a note

User Contributed Notes 1 note

up
-2
JUAN MORALES
2 years ago
to reproduce this, try

<?php

var_dump
(is_infinite(log(0)));
To Top