note 20822 added to function.array-search

From: Date: Wed, 17 Apr 2002 11:29:59 +0000
Subject: note 20822 added to function.array-search
Groups: php.notes 
Request: Send a blank email to php-notes+get-29470@lists.php.net to get a copy of this message
To future proof against the 4.2.0 return change something like this should work: $key = array_search($needle, $haystack); if(is_null($key)) $retval = false; and then test using: if($key !== false) { // $key exists in $haystack. } -- http://www.php.net/manual/en/function.array-search.php http://master.php.net/manage/user-notes.php?action=edit+20822 http://master.php.net/manage/user-notes.php?action=delete+20822 http://master.php.net/manage/user-notes.php?action=reject+20822

« previous php.notes (#29470) next »