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.
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments