Hi 2012/8/22 Levi Morrison <morrison.l...@gmail.com>: > On Tue, Aug 21, 2012 at 12:53 PM, Yasuo Ohgaki <yohg...@ohgaki.net> wrote: >> 2012/8/21 Levi Morrison <morrison.l...@gmail.com>: >>> >>> 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 >> yohg...@ohgaki.net > > I didn't say anything about `array_add`. I meant to say if you are > going to try to add something to the core that you need to be > consistent with the other array functions. > > Why use `array_walk` to delete elements? Isn't the whole point of > `array_delete` to make that process easier? >
The reason why use array_walk is this is the best way to delete elements with PHP. >From the Stack Overflow's page (and this thread), we can tell the problem is lack of intuitive API for array element deletion. > I think you missed the whole point of my last message: keep the > functions you propose similar to ones that already exist. That's my point, too. array_walk() is there from PHP3 at least, IIRC. array_delete() is easier to use, too. i.e. No "use (&$array)" for closure and counter variable when user would like to know how many elements were deleted. Regards, -- Yasuo Ohgaki yohg...@ohgaki.net -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php