$statements = new ByPropertyIdArray( iterator_to_array( $statements ) );
Where ByPropertyIdArray extends ArrayObject.
The problem I have with this is that I have an Iterator (which happens to be an ArrayObject) that I want to construct a new ByPropertyIdArray from (which is an Iterator) but that in the process it gets turned into an array. Iterator => array => Iterator is stupid.
I could ofc just loop over the Iterator and call append in the loop, but this is also not ideal.
Is there no nice and performant way to go from Iterator (or at least ArrayObject) to ArrayObject?

New Topic/Question
Reply




MultiQuote




|