Bug #79216 [Opn->Nab]: in_array bug

From: Date: Mon, 03 Feb 2020 16:55:22 +0000
Subject: Bug #79216 [Opn->Nab]: in_array bug
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-225335@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 Updated by: requinix@php.net Reported by: uugv_tl at 163 dot com Summary: in_array bug -Status: Open +Status: Not a bug 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: Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://www.php.net/manual/ and the instructions on how to report a bug at http://bugs.php.net/how-to-report.php Previous Comments: ------------------------------------------------------------------------ [2020-02-03 16:20:49] bugreports at gmail dot com 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. ------------------------------------------------------------------------ [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

« previous php.bugs (#225335) next »