On Mon, 11 Oct 2004 09:07:13 -0700, Brian Dunning
<[EMAIL PROTECTED]> wrote:

> The problem is that if the item is at index 0 in the array, array_search gives the 
> same answer as if it's not in there at all. 

No it doesn't.

If it's in index 0 it returns 0, if it's not there at all it returns FALSE.

you need to use something like:

   if (array_search($needle, $haystack) === false) {
     // add $needle to $haystack
   }

http://lv.php.net/array-search
http://php.net/manual/en/language.operators.comparison.php

  -robin

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to