Answer the question
In order to leave comments, you need to log in
XPath: how to loop through all text nodes inside a paragraph?
Hello!
Guys, please tell me how to iterate over all text nodes inside, say, a paragraph? After all, they can be 2-3 levels.
Look, there is a paragraph:
<p>Lorem <i>ipsum dolor</i> sit <span>amet, <b><i>consectetur</i> adipisicing</b> elit</span>. Odit, sunt?</p>
.//p
foreach ($elements as $element) {
// Lorem;
// ipsum dolor;
// sit;
// amet,;
// consectetur;
// adipisicing;
// elit;
// . Odit, sunt?;
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question