3v4l.org

run code in 300+ PHP versions simultaneously
<?php $test_content=' <script> //<!-- a = "123"; b = "</script>"; c = "456; //--> </script> '; $d=new DOMDocument(); $d->loadHTML($test_content); echo $d->saveHTML();
Output for 8.0.30, 8.1.22 - 8.1.28, 8.2.9 - 8.2.18, 8.3.0 - 8.3.4, 8.3.6
Warning: DOMDocument::loadHTML(): Unexpected end tag : script in Entity, line: 9 in /in/qljUH on line 16 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd"> <html><head><script> //<!-- a = "123"; b = "</script></head><body><p>"; c = "456; //--&gt; </p></body></html>
Output for 8.3.5
Warning: PHP Startup: Unable to load dynamic library 'sodium.so' (tried: /usr/lib/php/8.3.5/modules/sodium.so (libsodium.so.23: cannot open shared object file: No such file or directory), /usr/lib/php/8.3.5/modules/sodium.so.so (/usr/lib/php/8.3.5/modules/sodium.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0 Warning: DOMDocument::loadHTML(): Unexpected end tag : script in Entity, line: 9 in /in/qljUH on line 16 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd"> <html><head><script> //<!-- a = "123"; b = "</script></head><body><p>"; c = "456; //--&gt; </p></body></html>
Output for 7.0.0 - 7.0.20, 7.1.0 - 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: 9 in /in/qljUH on line 16 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd"> <html><head><script> //<!-- a = "123"; b = "</script></head><body><p>"; c = "456; //--&gt; </p></body></html>

preferences:
135.84 ms | 403 KiB | 173 Q