I have a very long HTML text in which I want iterate id value of a p
tag in PHP. My original string:
$mystring="
<p> my very long text with a lot of words ....</p>
<p></p>
<p> my other paragraph with a very long text ...</p>
(...)
";
Result that I want:
$myparsestring= "
<p id=1>my very long text with a lot of words ....</p>
<p id=2> my other paragraph with a very long text ...</p>
";
As you can see, I can use getElementsByTagName ()
and regex (may be split).
What is your guidance to do this job?