For example in my HTML I have “img” tags.
I want to pack them into “a” tags
If I do this one time everything is ok. But next time the tag which is already packed, packs again and it’s bad. What I want is to understand is the “img” already packed into “a” or not.
for this I can use following…
$doc = new DOMDocument();
$doc->loadHTML($article_header);
$imgs = $doc->getElementsByTagName('img');
foreach ($imgs as $img) {
?????
}
So I will get “img” tags by this. Now How to get parent node of the “img” and check if it is “a”?
?????would be: