<?php $arr = [ 'lvl1-A' => [ 'lvl2' => [ 'lvl3' => 'done' ], ], 'lvl1-B' => 'done', ]; function traverse( \Traversable $it ): void { while ( $it->valid() ) { $it->hasChildren() ? print "{$it->key()} => \n" and traverse( $it->getChildren() ) : print "{$it->key()} => {$it->current()}\n"; $it->next(); } } $it = new \RecursiveArrayIterator( $arr ); $it->rewind(); traverse( $it ); print 'Done.';
You have javascript disabled. You will not be able to edit any code.
Value for `_results` contains invalid data `array`