preg_match("/<some_tag >([^']*?)<\/some_tag>/", $data, $matches)
preg_match_all( "/<p>(.*?)<\/p>/", $matches[1], $paragraphs);
foreach ($paragraphs[0] as $paragraph) {
$content=$conte nt.$paragraph;
}
The above code only works if <pis the first tag under <some_tag>. i.e,
works with
<some_tag >
<p>blah</p>
</some_tag>
but not with
<some_tag >
<some_other_tag >blah</some_other_tag>
<p>blah</p>
</some_tag>
How could I make the code works regardless of the position of <punder
<some_tag>? Thank you.
preg_match_all( "/<p>(.*?)<\/p>/", $matches[1], $paragraphs);
foreach ($paragraphs[0] as $paragraph) {
$content=$conte nt.$paragraph;
}
The above code only works if <pis the first tag under <some_tag>. i.e,
works with
<some_tag >
<p>blah</p>
</some_tag>
but not with
<some_tag >
<some_other_tag >blah</some_other_tag>
<p>blah</p>
</some_tag>
How could I make the code works regardless of the position of <punder
<some_tag>? Thank you.