3v4l.org

run code in 300+ PHP versions simultaneously
<?php $test_content=' <script> //<!-- a = "123"; b = "</script>"; c = "456; //--> </script> '; $d=new DOMDocument(); $d->loadHTML($test_content); echo $d->saveHTML();
Output for 8.0.30, 8.1.22 - 8.1.33, 8.2.9 - 8.2.29, 8.3.0 - 8.3.27, 8.4.1 - 8.4.14
Warning: DOMDocument::loadHTML(): Unexpected end tag : script in Entity, line: 9 in /in/qljUH on line 16 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd"> <html><head><script> //<!-- a = "123"; b = "</script></head><body><p>"; c = "456; //--&gt; </p></body></html>
Output for 7.0.0 - 7.0.20, 7.1.0 - 7.1.20, 7.2.0 - 7.2.33, 7.3.16 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.29, 8.1.0 - 8.1.21, 8.2.0 - 8.2.8
Warning: DOMDocument::loadHTML(): Unexpected end tag : script in Entity, line: 9 in /in/qljUH on line 16 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd"> <html><head><script> //<!-- a = "123"; b = "</script></head><body><p>"; c = "456; //--&gt; </p></body></html>

preferences:
92.18 ms | 410 KiB | 5 Q