Bug #79216 [Com]: in_array bug
| From: | bugreports at gmail dot com | Date: | Mon, 03 Feb 2020 16:20:49 +0000 |
| Subject: | Bug #79216 [Com]: in_array bug | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-225334@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=79216&edit=1
ID: 79216
Comment by: bugreports at gmail dot com
Reported by: uugv_tl at 163 dot com
Summary: in_array bug
Status: Open
Type: Bug
Package: *General Issues
Operating System: macos 10.15.3
PHP Version: 7.2.27
Block user comment: N
Private report: N
New Comment:
https://www.php.net/manual/en/language.types.type-juggling.php
https://www.php.net/manual/en/function.in-array.php
strict
If the third parameter strict is set to TRUE then the in_array() function will also check the
types of the needle in the haystack.
Previous Comments:
------------------------------------------------------------------------
[2020-02-03 15:54:53] uugv_tl at 163 dot com
Description:
------------
$arr = array('b', 0);
if(in_array('abc',$arr))
{
echo 'ok';
}
else
{
echo 'bad'
}
when above statement echo 'ok',shoud be echo 'bad' right?
Test script:
---------------
$arr = array('b', 0);
if(in_array('abc',$arr))
{
echo 'ok';
}
else
{
echo 'bad'
}
shoud be echo 'bad',but echo 'ok'
Expected result:
----------------
'bad'
Actual result:
--------------
'ok'
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=79216&edit=1