Am 16.08.2012 07:55, schrieb Sherif Ramadan:
Now your array is something completely different from what you wanted.
The solution stated earlier is the most sane one (just using
array_keys() with a search value).

the array_keys solution is slower (although barely) than my suggested array_slice solution but comes up short when looking at the result closely. The resulting array won't be properly indexed anymore, but will be a numbered hashmap. I am not sure wether PHP keeps an internal state on wether an array is a map or a classic array, but when you require indizes to be sequential (without gaps) then unset() just won't do. Thus it's not always a simple problem.

I don't wish to degrade anyone's contributions to this thread, but
this really is the perfect example of making a lot of fuss over
nothing on the mailing list and an example of the kinds of discussion
we should be avoiding when there are so many other important problems
we can solve.

Rasmus' suggestion was very concise and unfussy. I've been wondering the same thing for some time. It would make the array-functionset more complete and code more explicit. Why should we only talk about major changes and additions?


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

Reply via email to