RecursiveIteratorIterator last child

RDR

New Member
I iterate through a multidimensional array with RecursiveIteratorIterator and would like to be able to know if the current element is the last child of it's depth. I thought about this:\[code\]$iterator = new RecursiveIteratorIterator($array, RecursiveIteratorIterator::SELF_FIRST); foreach ($iterator as $val) { $next = clone $iterator; $next->next(); $lastChild = ($next->getDepth() < $iterator->getDepth());}\[/code\]But the RecursiveIteratorIterator says it's not cloneable.
 
Back
Top