3v4l.org

run code in 300+ PHP versions simultaneously
<?php $test_content=' &lt;script&gt; //<!-- a = "123"; b = "&lt;/script&gt;"; c = "456; //--> &lt;/script&gt; '; $d=new DOMDocument(); $d->loadHTML($test_content); echo html_entity_decode($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
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd"> <html><body><p><script> //<!-- a = "123"; b = "</script>"; c = "456; //--> </script> </p></body></html>
Output for 7.0.0 - 7.0.20, 7.1.0 - 7.1.25, 7.2.0 - 7.2.33, 7.3.0 - 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
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd"> <html><body><p><script> //<!-- a = "123"; b = "</script>"; c = "456; //--> </script></p></body></html>

preferences:
98.86 ms | 409 KiB | 5 Q