I think adding more collection-types is the intuitive reaction to this issue, but there's something to be said for the idea of having only a single collection-type - I think that's one PHP feature we should not give up.
Not having to pick and choose (and compromise) to select the "right" collection-type, and not having to refactor when you realize you needed another collection-type - as well as easy comprehension for developers... these are valuable aspects of having only a single collection-type. Some newer languages like Opa embrace that idea with great elegance. Giving up on that idea should be the last option, in my opinion. There are plenty of cases for collections of objects that do not have a scalar key, where the key is indeterminate, or where the key can change - and thus cannot have known indexes. As an aside note, I recently benchmarked array_search() for a project that needs to store many different types of objects in a list - and searching a list with 1000 objects for one specific object is extremely fast: a couple of micro-seconds more (per search) when compared against a hash-based lookup with a known key, so (in my case) nothing to worry about at all in terms of performance. Arrays are a powerful and pure feature in PHP - I would vote against introducing more collection-types, and instead leverage the already powerful and well-understood existing singular collection-type. On Sat, Aug 18, 2012 at 2:42 AM, Alexey Zakhlestin <indey...@gmail.com>wrote: > > On 16.08.2012, at 0:18, Rasmus Schultz <ras...@mindplay.dk> wrote: > > > How come there is no straight-foward obvious way to simply remove a given > > value from an array? > > Well, this sounds like a reason for creating SplSet class > >