Some major points to consider for `array_delete`'s behavior: 1. Should items be compared with `==`, `===`, or custom comparison? If we use `==` or `===` we'd probably add `array_udelete` to allow a custom comparator. 2. Should it stop when it encounters the first value that matches? If it does, should we add a function that searches in the reverse direction? 3. Should it modify the array in-place? If so, should we have another function that returns a copy of the array that does not include the removed value(s) instead?
If someone wants to go through and define all of these cases and propose a patch, more power to them. ----- Here are some reasons that aren't related to the above as to why I'm against adding `array_delete`: 1. PHP arrays are not sets. PHP arrays are meant to be a list and an associative array. As such, a PHP array can act as any* data structure that can be built from a list or associative array. A data structure that removes something by value is typically associated with a set and therefore does not belong in an array. 2. Using other array functions cover this use case AND do a better job. Want to remove the first instance of the value? Use `array_search` to find the index and unset it. If you want to reorder the array you can use `array_search` to find the index and use `array_slice`. Want to remove all instances of the value in the array? Use `array_filter`. -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
