I am trying to get the whole current array and I don't think I have gone the right way about it as I get an Undefined index error sometimes.
$iterator = new RecursiveIteratorIterator(new RecursiveArrayIterator($comments_array), RecursiveIteratorIterator::SELF_FIRST);
while ($iterator->valid()) {
if ($iterator->hasChildren()) {
$row = $iterator->getChildren();
$depth = $iterator->getDepth();
echo $row['User_ID'] . "<br>";
}
$iterator->next();
}
I know you can do foreach ($iterator->getChildren() as $key => $value)
but that doesn't help me as I want the whole array.
Hope this makes sense?!