3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $doc = new DOMDocument(); $doc->loadHTML('<html> <head> </head> <body> <script> <!-- console.log("<h1>hello</h1>"); // --> </script> </body> </html>'); echo $doc->saveHTML();
based on PBo3i
Output for 7.0.20, 7.1.5 - 7.2.0
Warning: DOMDocument::loadHTML(): Unexpected end tag : h1 in Entity, line: 7 in /in/dHfdC on line 5 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd"> <html><head></head><body> <script> <!-- console.log("<h1>hello"); // --> </script></body></html>
Output for 5.3.19 - 7.0.6, 7.1.0
Warning: DOMDocument::loadHTML(): Unexpected end tag : h1 in Entity, line: 7 in /in/dHfdC on line 15 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd"> <html><head></head><body> <script> <!-- console.log("<h1>hello"); // --> </script></body></html>