Rasmus Schultz wrote:

> I disagree - this is (or should be) a simple, atomic operation...
> yet, you've got a function-call, an intermediary variable, a boolean
> test, and an unset statement repeating the name of the array you're
> deleting from.
>
> This should be a simple statement or function/method-call, and in
> most other languages it would be...

How simple is it? Does it:

1) Remove one occurrence of the element (presumably the first) or all?
2) Reindex the array (as someone else argued was necessary to make it "properly indexed" afterwards) or not?
3) Modify the array in-place or return a modified array?
4) Use type-strict or normal comparisons?

That's sixteen different interpretations of "remove a given value from an array" right there. Leave support for any of them out and someone is going to complain that they have to write a function to do what should be a "simple statement". Support all of them and there will probably _still_ be someone who wants their own particular set of circumstances catered for without having to write their own function to do it.

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

Reply via email to