a b
both $foo->textContent and $foo->nodeValue return a
$foo->textContent
$foo->nodeValue
a
Use firstChild :
firstChild
$foo->firstChild->textContent;