Bug #16146 Updated: array_search always skips first element of array
| From: | derick@php.net | Date: | Mon, 18 Mar 2002 15:28:35 +0000 |
| Subject: | Bug #16146 Updated: array_search always skips first element of array | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-2769@lists.php.net to get a copy of this message | ||
ID: 16146
Updated by: derick@php.net
Reported By: carl@bodgadle.com
-Status: Open
+Status: Bogus
Bug Type: Arrays related
Operating System: Solaris
PHP Version: 4.0.6
New Comment:
From the manual (www.php.net/array_search):
array_search -- Searches the array for a given value and returns the
corresponding key if successful
Warning
This function may return Boolean FALSE, but may also return
a
non-Boolean value which evaluates to FALSE, such as 0 or "".
Please
read the section on Booleans for more information. Use the
===
operator for testing the return value of this function.
Previous Comments:
------------------------------------------------------------------------
[2002-03-18 10:23:39] carl@bodgadle.com
I think i've discovered a problem with array_search. If I have an
array, say
$arr = Array("one","two","a");
then I try
$retVal = array_search("one",$arr);
it will return false, however the other two elements are fine.
It seems array_search just ignores the first element in the array, I
can search the rest of the array fine, just not the first element. If I
put another item at the start I can find "one" fine.
in_array works fine, it's just array_search that fails
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=16146&edit=1