I want to get the HTML inside the parent element using php. For example, I have this structure:
<p>
<p>this is my first xml file </p>
</p>
and I want to get below text as a result.
<p>this is my first xml file </p>
Make use of a DOM Parser
<?php
$html='<p>
<p>this is my first xml file </p>
</p>';
$dom = new DOMDocument;
@$dom->loadHTML($html);
foreach ($dom->getElementsByTagName('p') as $tag){
if(!empty($tag->nodeValue)){ echo $tag->nodeValue;}
}