[PHP] array_search does not find the first element
Hi there, I am trying to find values inside an array. This array always starts with 0. unfortunatelly array_search start searching with the array element 1. So the first element is always overlooked. How could I shift this array to start with 1, or make array-search start with 0? The array comes out of an xml webservice, so I can not rally modify the results. array_search($check_date, $results) Thanx for any help on that. Merlin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] array_search does not find the first element
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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] array_search does not find the first element
Merlin wrote: I am trying to find values inside an array. This array always starts with 0. unfortunatelly array_search start searching with the array element 1. So the first element is always overlooked. Please read the text inside the big Warning box on the following page: http://us2.php.net/array_search Thanks. ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php