- simplexml_load_string: documentation ( source)
<?php
$html = <<<HTML
<div class="d-xl-none">
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbar-top-menu">
<i class="icon-grid3"></i>
</button>
</div>
<div class='class_1'>
<span>test</span>
</div>
HTML;
$xml = simplexml_load_string("<root>{$html}</root>");
echo $xml->xpath('//div[@class="d-xl-none"]/*')[0]->asXML();
echo PHP_EOL, '===========================', PHP_EOL;
echo $xml->xpath('//div[@class="class_1"]/*')[0]->asXML();