note 58340 added to function.in-array
| From: | mano at easymail dot hu | Date: | Tue, 01 Nov 2005 11:19:24 +0000 |
| Subject: | note 58340 added to function.in-array | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-97915@lists.php.net to get a copy of this message | ||
Note, that in php's comparison table it says "php"==0 is true, so if:
(second table: http://www.php.net/manual/en/types.comparisons.php)
<?php
$foo = in_array(0, array("x", "y")); // foo is TRUE!!!!! AAAH!
?>
because 0 and any string is equal. Of course, 0==="php" is not equal, false, but
0==="0" false too.
nice comparison tables by the way...
.mano
----
Manual Page -- http://www.php.net/manual/en/function.in-array.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+58340
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+58340&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+58340&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+58340&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+58340&report=yes&reason=useless
Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+58340&report=yes&reason=non-english
Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+58340&report=yes&reason=already+in+docs
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+58340&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+58340&report=yes
Search -- http://master.php.net/manage/user-notes.php