downloads | documentation | faq | getting help | mailing lists | licenses | wiki | reporting bugs | php.net sites | conferences | my php.net

search for in the

is_nan> <is_finite
[edit] Last updated: Fri, 24 Jun 2011

view this page in

is_infinite

(PHP 4 >= 4.2.0, PHP 5)

is_infiniteیافتن بینهایت بودن مقدار

Description

bool is_infinite ( float $val )

بازگرداندن TRUE اگر val بینهایت باشد (مثبت یا منفی) مانند نتیجه log(0) یا هر مقدار بزرگ برای جاگذاری در مقدار ممیز شناور این پلتفرم.

Parameters

val

مقدار برای بررسی

Return Values

TRUE اگر val بینهایت باشد در غیر این صورت FALSE.

See Also

  • is_finite() - Finds whether a value is a legal finite number
  • is_nan() - یافتن عدد بودن یک مقدار



is_nan> <is_finite
[edit] Last updated: Fri, 24 Jun 2011
 
add a note add a note User Contributed Notes is_infinite - [4 notes]
up
1
Anonymous
6 years ago
@ david,

That will return true for any string ending with "INF".
I think substr("$value",0,3) would be more appropriate.
up
0
Anonymous
1 year ago
PHP_INT_MAX is The largest integer supported in this build of PHP. Usually int(2147483647). Available since PHP 4.4.0 and PHP 5.0.5
up
-1
david(@t)nirvanis(d@t)org
8 years ago
If you have PHP lower than 4.2 you can simulate the behaviour:

function is_infinite($value) {
   return (substr("$value",-3) == "INF");
}

(tested on php 4.1.2)
up
-3
stangelanda at arrowquick dot com
5 years ago
Actually any string ending in INF is more appropriate than any string beginning with INF.  Since negative infinity evaluates to "-INF" but it is still infinite.  However in either case the STRING "INF" is not infinite, only a float that converts to "INF" or "-INF" is infinite.

A more appropriate function might be:
<?php
if (!is_defined('is_infinite')) { function is_infinite($val) {
    return (
is_float($val) and ("$val"=='INF' or "$val"=='-INF'));
} }
?>
* However the above function is untested.

 
show source | credits | stats | sitemap | contact | advertising | mirror sites