note 117310 added to function.is-nan
| From: | 10basetom | Date: | Wed, 20 May 2015 02:29:20 +0000 |
| Subject: | note 117310 added to function.is-nan | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-202614@lists.php.net to get a copy of this message | ||
I would use is_numeric() instead of ctype_digit() if you cannot be 100% sure what data type the
string will be. Example from the docs:
<?php
$numeric_string = '42';
$integer = 42;
ctype_digit($numeric_string); // true
ctype_digit($integer); // false (ASCII 42 is the * character)
is_numeric($numeric_string); // true
is_numeric($integer); // true
?>
----
Server IP: 72.52.91.14
Probable Submitter: 116.12.250.1
----
Manual Page -- http://php.net/manual/en/function.is-nan.php
Edit -- https://master.php.net/note/edit/117310
Del: integrated -- https://master.php.net/note/delete/117310/integrated
Del: useless -- https://master.php.net/note/delete/117310/useless
Del: bad code -- https://master.php.net/note/delete/117310/bad+code
Del: spam -- https://master.php.net/note/delete/117310/spam
Del: non-english -- https://master.php.net/note/delete/117310/non-english
Del: in docs -- https://master.php.net/note/delete/117310/in+docs
Del: other reasons-- https://master.php.net/note/delete/117310
Reject -- https://master.php.net/note/reject/117310
Search -- https://master.php.net/manage/user-notes.php