This is my array:
ArrayObject::__set_state(
array( 'data' =>
array (
'key1' => '573779',
'key2' => 'REF12345',
'key3' => '2010-07-12',
'key4' => '0000-00-00',
'key5' => '2010-07-12',
'key6' => '21654',
'key7' => '0',
'key8' => ArrayObject::__set_state(array( )),
'key9' => ArrayObject::__set_state(array( )),
'key10' => array ( ),
'key11' => array ( ),
)
)
I’m interested in finding out out how to retrieve any of the values for a key using SPL. Any of the keys can have arrays within arrays so I’m unsure how to obtain a value. I thought I may be able to use ->offsetGet('') but this only retrieves from the top-most array.
ArrayObject implements ArrayAccess so you can simply access them with the regular Array Notation, e.g.
In addition, ArrayObjects are IteratorAggregates, so you can iterate over them with
foreachand decorate them with any of the SPL iterators, including the RecursiveIteratorIterator