I’m trying to write a function that will receive a DOMElement object, perform some seeking operations within its descendants and then return the DOMElement corresponding to the wanted parameters.
Shortened version:
function untilUHitText($domElement){
echo "<br>before anything happens<br>";
var_dump($domElement);
if($domElement->tagName == "Text" || $domElement->childElementCount == 0){
return $domElement;}
}
The var_dump
will show the passed DOMElement without any issue, but the returned $domElement is always null, even though I do not perform any operations on it.
I have tried changing the code within the function, but as soon as I perform any check on $domElement, it just returns a null value.