PHP: how can I sort and filter an “array”, that is an Object, implementing ArrayAccess?

You can't. The purpose of the ArrayAccess interface is not just to create an OOP wrapper for arrays (although it is often used as such), but also to allow array-like access to collections that might not even know all their elements from the beginning. Imagine a web service client, that calls a remote procedure in offsetGet() and offsetSet() .

You can access arbitrary elements, but you cannot access the whole collection - this is not part of the ArrayAccess interface.

It's possible, but not ideal. I see that people somehow think that it can't be done, just because the system (PHP) was designed this way. But your boss or your users don't care.

You can't say to your users: "sorry guys, I can't give you this feature because the array_filter expects an array, but my users are in a Collection object".

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions