Bug #73955 [Opn->Nab]: array_search returns null

From: Date: Wed, 18 Jan 2017 09:41:19 +0000
Subject: Bug #73955 [Opn->Nab]: array_search returns null
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-206724@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=73955&edit=1 ID: 73955 Updated by: requinix@php.net Reported by: 171933346 at qq dot com Summary: array_search returns null -Status: Open +Status: Not a bug Type: Bug Package: *General Issues Operating System: mac PHP Version: 5.6.29 Block user comment: N Private report: N New Comment: Built-in functions typically return NULL when the arguments given are not of the correct types. http://php.net/manual/en/functions.internal.php Previous Comments: ------------------------------------------------------------------------ [2017-01-18 09:38:03] 171933346 at qq dot com Description: ------------ array_search($value,$arr); the returns of this function is not expected。it displays false or the key from doc. but I get false、null、key。 php -version : 5.6.10 Test script: --------------- $arr = null; $key = array_search(2, $arr); if( $key === false) echo 'no value'; else echo 'the key is '.$key; ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=73955&edit=1

« previous php.bugs (#206724) next »