note 20822 deleted from function.array-search by felipe
| From: | felipe@php.net | Date: | Sun, 10 Feb 2008 13:11:56 +0000 |
| Subject: | note 20822 deleted from function.array-search by felipe | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-135970@lists.php.net to get a copy of this message | ||
Note Submitter: moz at the-allens dot net
----
To future proof against the 4.2.0 return change something like this should work:
<?php
$key = array_search($needle, $haystack);
if(is_null($key))
$retval = false;
?>
and then test using:
<?php
if($key !== false)
{
// $key exists in $haystack.
}
?>