Bug #69869 [Opn->Nab]: in_array funciton bug
| From: | cmb@php.net | Date: | Thu, 18 Jun 2015 08:53:36 +0000 |
| Subject: | Bug #69869 [Opn->Nab]: in_array funciton bug | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-193643@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=69869&edit=1
ID: 69869
Updated by: cmb@php.net
Reported by: halfik at gmail dot com
Summary: in_array funciton bug
-Status: Open
+Status: Not a bug
Type: Bug
Package: Arrays related
Operating System: Windows/Linux
PHP Version: 5.6.10
-Assigned To:
+Assigned To: cmb
Block user comment: N
Private report: N
New Comment:
Sorry, but your problem does not imply a bug in PHP itself. For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system
is not the
appropriate forum for asking support questions. Due to the volume
of reports we can not explain in detail here why your report is not
a bug. The support channels will be able to provide an explanation
for you.
Thank you for your interest in PHP.
Consider 0=='red' and true=='red'. You may want to use the third parameter of
in_array().
Previous Comments:
------------------------------------------------------------------------
[2015-06-18 08:32:59] halfik at gmail dot com
Description:
------------
var_dump(in_array(0, ['red', 'green', 'blue']));
and
var_dump(in_array(true, ['red', 'green', 'blue']));
both will return true. i tested this on couple 5.x versions and 4.x
Test script:
---------------
var_dump(in_array(0, ['red', 'green', 'blue']));
var_dump(in_array(true, ['red', 'green', 'blue']));
Expected result:
----------------
bool(false)
bool(false)
Actual result:
--------------
bool(true)
bool(true)
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=69869&edit=1