Re: re: removing an item from an array
| From: | Yasuo Ohgaki | Date: | Tue, 21 Aug 2012 18:53:13 +0000 |
| Subject: | Re: re: removing an item from an array | ||
| References: | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-62348@lists.php.net to get a copy of this message | ||
Hi,
2012/8/21 Levi Morrison <morrison.levi@gmail.com>:
> On Tue, Aug 21, 2012 at 3:36 AM, Yasuo Ohgaki <yohgaki@ohgaki.net> wrote:
>> Hi
>>
>> 2012/8/21 Tjerk Anne Meesters <datibbaw@php.net>:
>>> On Tue, Aug 21, 2012 at 10:31 AM, Rasmus Schultz <rasmus@mindplay.dk> wrote:
>>>
>>>> Thank you, but this isn't really anything like what I had in mind.
>>>>
>>>> What I had in mind is more like set-semantics for arrays, e.g. designed to
>>>> work with sets of distinct values/objects.
>>>>
>>>> Since I do not have permission to write on the wiki, I posted an initial
>>>> draft here:
>>>>
>>>> https://gist.github.com/321ad9b4b8c4e1713488
>>>
>>>
>>> Just an idea, since array_delete() may remove multiple values, I would
>>> change the return value to (int) and return how many elements were removed
>>> from the array.
>>
>> Int would be better and callable should be accepted like array_walk().
>> It's better to have array_delete_recursive(), too.
>> I updated the page.
>>
>> array_add() needs more discussion.
>> What we should do with array value, accept callable or not, etc.
>>
>> Regards,
>>
>> --
>> Yasuo Ohgaki
>> yohgaki@ohgaki.net
>>
>
> I'm against this RFC, but if you are going to even try to add
> something, please keep it consistent! Don't modify
>
array_delete to
> take a callable, instead make a different function
> array_udelete or
> something.
>
Original proposal is adding array_delete() and this is under discussion.
We don't have to add array_add()
> And keep default $strict values consistent with existing functions
> that have that parameter.
Users should use array_walk() when they would like to delete element(s).
To be consistent, it should be callable.
Regards,
--
Yasuo Ohgaki
yohgaki@ohgaki.net