Re: Array remove function?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, April 10, 2007 3:22 pm, Tijnema ! wrote:
> On 4/10/07, Daevid Vincent <daevid@xxxxxxxxxx> wrote:
>> OMG. Now that is the best idea. How simple. Guess I learned
>> something new
>> today too! :)
>>
>> > -----Original Message-----
>> > From: Lori Lay [mailto:llay@xxxxxxxxxxxxxxxxxxx]
>> >
>> > Use array_search() and unset()?
>
> Interesting, I didn't thought of that :)
>
> But should i submit a future request for such function?

Here's the thing...

I don't think there should be such a function for several reasons:

#1. The same value could be there for mulitple keys.
#2. What test is used to determine if values are "equal"?
    Are '0' and 0 the same?
#3. array_search + unset is not exactly horrible
#4. One really shouldn't write code that paints one into this corner...
    If one needs to track the values efficiently to remove them,
    there should be an array (or other data structure) with the
    value as a 'key' to do fast lookup of whatever needs to be deleted

All just imho, of course.


-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux