note 18780 added to function.intval
| From: | w dot strasser at mobilkom dot at | Date: | Tue, 05 Feb 2002 16:22:44 +0000 |
| Subject: | note 18780 added to function.intval | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-26261@lists.php.net to get a copy of this message | ||
In response to the Editor's note for the post by nefer@ncport.ru
(15-Dec-2000 05:20):
The expression
if (intval($param) == $param)
...
returns also always true. Obviously $param on the right side is casted implicitly to an integer, in
the same manner like on the left side.
If you cast the left side back to string it works:
if ((string)intval($param) == $param)
// $param is an integer
else
// $param is no integer
--
http://www.php.net/manual/en/function.intval.php
http://master.php.net/manage/user-notes.php?action=edit+18780
http://master.php.net/manage/user-notes.php?action=delete+18780
http://master.php.net/manage/user-notes.php?action=reject+18780