3v4l.org

run code in 300+ PHP versions simultaneously
<?php $content = <<<HTML <div class="directions"> <div class="left">ä,ö,ü</div> <div class="right">right</div> </div> HTML; libxml_use_internal_errors(true); libxml_disable_entity_loader(true); $html = new DOMDocument(); $html->loadHTML(mb_convert_encoding($content, 'HTML-ENTITIES', 'UTF-8')); $xpath = new DOMXpath($html); $result = $xpath->query('//div[contains(@class, "left")]'); echo $result[0]->textContent;
Output for 8.4.1 - 8.4.2
Deprecated: Function libxml_disable_entity_loader() is deprecated since 8.0, as external entity loading is disabled by default in /in/M0TQX on line 11 Deprecated: mb_convert_encoding(): Handling HTML entities via mbstring is deprecated; use htmlspecialchars, htmlentities, or mb_encode_numericentity/mb_decode_numericentity instead in /in/M0TQX on line 14 ä,ö,ü
Output for 8.2.0 - 8.2.27, 8.3.0 - 8.3.15
Deprecated: Function libxml_disable_entity_loader() is deprecated in /in/M0TQX on line 11 Deprecated: mb_convert_encoding(): Handling HTML entities via mbstring is deprecated; use htmlspecialchars, htmlentities, or mb_encode_numericentity/mb_decode_numericentity instead in /in/M0TQX on line 14 ä,ö,ü
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.31
Deprecated: Function libxml_disable_entity_loader() is deprecated in /in/M0TQX on line 11 ä,ö,ü
Output for 7.2.0 - 7.2.34, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33
ä,ö,ü

preferences:
96.1 ms | 410 KiB | 5 Q