Morning! I have started using DOMdocument for a job but hit an issue with this code snippet.
if ($txtnode1->parentNode->hasChildNodes()) {
Echo "***Has Children Start***<br>";
foreach ($txt1->parentNode as $child) {
Echo "NodeChild<br>";
}
Echo "***Has Children End***<br>";
}
I get the output:
***Has Children Start***
***Has Children End***
So
($txtnode1->parentNode->hasChildNodes())
is true;
But
foreach ($txtnode1->parentNode as $child)
Isn't looping.... I think indicating there are no children?
But there must be a child.... because we are going to $txtnode1's parentNode... so in summary i am very confused!
Any help greatly appreciated. TIA.