its good that there is iterator to array http://php.net/manual/en/function.iterator-to-array.php but is there anything to do it reversed?
Yes, if reversed means just make an Iterator from a given Array.
$array = array(
'a' => 1,
2 => new stdClass,
3 => array('subArrayStuff'=>'value')
);
$iterator = new ArrayObject($array);
$arrayAgain = iterator_to_array($iterator);
Try it.
http://php.net/manual/en/class.arrayobject.php
Please read also Difference between ArrayIterator, ArrayObject and Array in PHP.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With