3v4l.org

run code in 300+ PHP versions simultaneously
<?php $doc = new DOMDocument(); $doc->loadHTML('<html> <body> <h1>hai</h1> <script> console.log("</script>"); </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 : script in Entity, line: 6 in /in/4dZI4 on line 5 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd"> <html> <body> <h1>hai</h1> <script> console.log("</script>"); </body> </html>
Output for 7.1.4 - 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: 6 in /in/4dZI4 on line 5 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd"> <html><body> <h1>hai</h1> <script> console.log("</script>"); </body></html>
Output for 7.1.0 - 7.1.3
Warning: DOMDocument::loadHTML(): Unexpected end tag : script in Entity, line: 6 in /in/4dZI4 on line 12 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd"> <html><body> <h1>hai</h1> <script> console.log("</script>"); </body></html>

preferences:
157.8 ms | 401 KiB | 159 Q