BTW, if you need to change array later, use exchangeArray() method. Good to know when you are writing a class that extends ArrayObject()
AFAIK, exchangeArray() doesn't return anything.
<?php
$a = array('one', 'two', 'three');
$ao = new ArrayObject($a);
foreach ($ao as $element) {
echo $element . ' '; // one two three
}
$b = array('four', 'five', 'six');
$ao->exchangeArray($b); // returns null
foreach ($ao as $element) {
echo $element . ' '; // four five six
}
?>