|
PODRĘCZNIK PHP 5.x, 4.x, 3.x - częściowo spolszczony / źródło: www.php.net
[Spis]
[A]
[B]
[C]
[D]
[E]
[F]
[G]
[H]
[I]
[J]
[K]
[L]
[M]
[N]
[O]
[P]
[Q]
[R]
[S]
[T]
[U]
[V]
[X]
[W]
[Z]
is_nan (PHP 4 >= 4.2.0, PHP 5) is_nan --
Bada, czy wartość jest symbolem nieoznaczonym
Opisbool is_nan ( float wartość )
Zwraca TRUE, jeśli wartość jest określana jako
'not a number' (symbol nieoznaczony), czyli nie jest liczbą,
tak jak wartość funkcji
acos(1.01).
User Contributed NotesSku
04-Dec-2005 10:29
Hi nez,
better would be:
function isNaN( $var ) {
return !ereg ("^[-]?[0-9]+([\.][0-9]+)?$", $var);
}
ys, Sku
nez [at] NOSPAM gazeta [dot] pl
26-Sep-2005 10:27
Paul, i guess better would be:
function isNaN( $var ) {
return ereg ("^[-]?[0-9]+([\.][0-9]+)?$", $var);
}
Vincent
24-Feb-2005 03:04
Since NaN is not even equal to itself, here is a way to test it:
<?php
function my_is_nan($_) {
return ($_ !== $_);
}
?>
paul at NOSPAM dot paultastic dot com
11-Jun-2002 08:55
See is_numeric if you have an older version of PHP than 4.20. It should serve your purpose well.
If you're using PHP 3, you can use a regular expression:
function isNaN( $var ) {
return ereg ("^[0-9\.]+$", $var);
}
|