The main issue is not using $it->next();
in your but that still many not give you the desired output because If you run print $it->current();
it would only return Array
since you can not output array information with print
.
You should be using RecursiveArrayIterator
and RecursiveIteratorIterator
since you are dealing with multidimensional array
To get all values try :
$it = new RecursiveIteratorIterator(new RecursiveArrayIterator($options));
foreach ( $it as $key => $val ) {
echo $key . ":" . $val . "\n";
}
See full demo : http://codepad.viper-7.com/UqF18q