php - Simple HTML DOM Parser - Get all plaintex rather than text of certain element
I tried all the solutions posted on this question. Although it is similar to my question, it's solutions aren't working for me.
I am trying to get the plain text that is outside of<b>
and it should be inside the<div id="maindiv>
.
<div id=maindiv>
<b>I don't want this text</b>
I want this text
</div>
$part is the object that contains<div id="maindiv">
.
Now I tried this:
$part->find('!b')->innertext;
The code above is not working. When I tried this
$part->plaintext;
it returned all of the plain text like this
I don't want this text I want this text
I read the official documentation, but I didn't find anything to resolve this:
Answer
Solution:
Query:
Explanation:
Example:
Answer
Solution:
remove the
<b>
first: