Re: array_search does not find the first element

From: Date: Wed, 31 Mar 2004 12:38:32 +0000
Subject: Re: array_search does not find the first element
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-181926@lists.php.net to get a copy of this message
Hi, Wednesday, March 31, 2004, 10:20:06 PM, you wrote: M> Hi there, M> I am trying to find values inside an array. This array always starts with 0. M> unfortunatelly array_search start searching with the array element 1. M> So the first element is always overlooked. M> How could I "shift" this array to start with 1, or make array-search start with 0? M> The array comes out of an xml webservice, so I can not rally modify the results. M> array_search($check_date, $results) M> Thanx for any help on that. M> Merlin If you are checking the return value you will need to use === as 0 will fail in == tests. As far as I know array_search() starts at the 0 key. -- regards, Tom

« previous php.general (#181926) next »