Hi,

2012/8/21 Herman Radtke <hermanrad...@gmail.com>:
>>> May be we should have something like
>>
>> >>
>> >> array_delete_if($array, function($v, $k=null) { if ($v == 300) return
>> >> true; })
>> >
>> > So array_filter?
>>
>> I'll use it or like for deleting, but the point of this thread is
>> "intuitive function for deleting element(s)"
>>
>> array_delete($array, $value|callable)
>>
>> would be nicer for users, perhaps.
>
>
> You are basically asking to alias array_filter with "array_delete". That is
> a very slippery slope. I think array_filter is very a very obvious choice to
> remove something from an array. The "filter" function/method is common in
> functional languages (and functional frameworks like Underscore).
>
> These are things developers just need to learn as part of development.
> Really, this is entire thread should be on stack overflow, not internals.

I guess you haven't read later post.

You've also made a novice mistake.
array_filter() DO NOT delete elements, but creates new array.
array_delete() is another form of array_walk(), not array_filter().
See my posts.

Having a API for dedicated task is good thing.
Who would argue array_pop()/array_push() isn't needed?

Regards,

--
Yasuo Ohgaki
yohg...@ohgaki.net

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to