I need an optimized or custom function to update the indexes of object extends ArrayObject
Example:
<?php
class MyCollection extends ArrayObject
{
// my logic for collection
}
$collection = new MyCollection([
'first',
'second',
'third',
]); // will output [0 => 'first', 1 => 'second', 2 => 'third']
$collection->offsetUnset(1); // will output [0 => 'first', 2 => 'third']
// some reindex function
$collection->updateIndexes(); // will output [0 => 'first', 1 => 'third']