Re: [PHP] Question about array_search

2004-10-11 Thread John Holmes
Greg Donald wrote: On Mon, 11 Oct 2004 09:07:13 -0700, Brian Dunning <[EMAIL PROTECTED]> wrote: Say I'm trying to add a value to an array, only if it's not already in there somewhere; so I do an array_search to see. The problem is that if the item is at index 0 in the array, array_search gives the

Re: [PHP] Question about array_search

2004-10-11 Thread John Holmes
Brian Dunning wrote: Say I'm trying to add a value to an array, only if it's not already in there somewhere; so I do an array_search to see. 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 the value

Re: [PHP] Question about array_search

2004-10-11 Thread Robin Vickery
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 FA

Re: [PHP] Question about array_search

2004-10-11 Thread Greg Donald
On Mon, 11 Oct 2004 09:07:13 -0700, Brian Dunning <[EMAIL PROTECTED]> wrote: > Say I'm trying to add a value to an array, only if it's not already in > there somewhere; so I do an array_search to see. The problem is that if > the item is at index 0 in the array, array_search gives the same answer >

Re: [PHP] Question about array_search

2004-10-11 Thread Matt M.
> Say I'm trying to add a value to an array, only if it's not already in > there somewhere; so I do an array_search to see. 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. How does one circumvent this potential > pit

[PHP] Question about array_search

2004-10-11 Thread Brian Dunning
Say I'm trying to add a value to an array, only if it's not already in there somewhere; so I do an array_search to see. 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. How does one circumvent this potential pitfall?