3v4l.org

run code in 300+ PHP versions simultaneously
<?php $html = 'abc&lt;def<br>g'; $dom = \Dom\HTMLDocument::createFromString($html, options: LIBXML_NOERROR | LIBXML_HTML_NOIMPLIED); var_dump($dom->textContent); $dom = new \DOMDocument(encoding: 'UTF-8'); $dom->loadHTML($html, LIBXML_NOERROR | LIBXML_HTML_NOIMPLIED); var_dump($dom->textContent);
Output for 8.4.1 - 8.4.14
NULL string(8) "abc<defg"
Output for 8.1.32, 8.2.0 - 8.2.29, 8.3.0 - 8.3.27
Fatal error: Uncaught Error: Class "Dom\HTMLDocument" not found in /in/t9WVN:5 Stack trace: #0 {main} thrown in /in/t9WVN on line 5
Process exited with code 255.

preferences:
59.17 ms | 407 KiB | 5 Q