3v4l.org

run code in 300+ PHP versions simultaneously
<?php $doc = new DOMDocument(); $doc->loadHTML('<html> <head> </head> <body> <script> //<!-- console.log("<h1>hello</h1>"); //--> </script> </body> </html>'); echo $doc->saveHTML();
Output for 8.0.30, 8.1.22 - 8.1.27, 8.2.9 - 8.2.17, 8.3.0 - 8.3.4
Warning: DOMDocument::loadHTML(): Unexpected end tag : h1 in Entity, line: 7 in /in/qpHRE 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 7.0.20, 7.1.5 - 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 : h1 in Entity, line: 7 in /in/qpHRE 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.4.0 - 5.4.45, 5.5.24 - 5.5.35, 5.6.8 - 5.6.28, 7.0.0 - 7.0.6, 7.1.0
Warning: DOMDocument::loadHTML(): Unexpected end tag : h1 in Entity, line: 7 in /in/qpHRE 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>

preferences:
172 ms | 402 KiB | 224 Q