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.28, 8.2.9 - 8.2.18, 8.3.0 - 8.3.6
Warning: DOMDocument::loadHTML(): Unexpected end tag : h1 in Entity, line: 6 in /in/2XufL 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: 6 in /in/2XufL 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.0 - 5.5.38, 5.6.0 - 5.6.28, 7.0.0 - 7.0.12, 7.1.0
Warning: DOMDocument::loadHTML(): Unexpected end tag : h1 in Entity, line: 6 in /in/2XufL on line 13 <!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:
239.5 ms | 403 KiB | 273 Q