I am try to find if a certain node has siblings, and if it does, I would like to know what those siblings are.
Is this possible?
In order to select a node's siblings, you have to use the corresponding XPath axe. Here is how to select all a node's siblings (ignoring the node itself)
$siblings = $node->xpath('preceding-sibling::* | following-sibling::*');
That's all you have to do.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With