You can always work with a copy of the array:
$array = $object->getArrayCopy(); // modify $array as needed, eg array_slice(....) $object = new ArrayObject($array);
In the past, the idea was to make all the functions that take arrays (or probably many of them) to accept an ArrayObject. But I donβt know how far this went, and if it did follow. I think ArrayObject is more of a behavioral thing than replacing an existing array with PHP.
Related question: PHP Array and ArrayObject
hakre
source share