3v4l.org

run code in 300+ PHP versions simultaneously
<?php $str = '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <meta http-equiv="content-type" content="text/html; charset=iso-8859-7"> <title>test</title> </head> <body><p>aaaaa' . chr(0xAE) . 'zzzzz</p></body> </html>'; $xml = new DOMDocument(); $xml->loadHTML($str); echo $xml->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(): input conversion failed due to input error, bytes 0x7A 0x7A 0x7A 0x7A in /in/4gvfZ on line 12 Warning: DOMDocument::loadHTML(): switching encoding: encoder error in Entity, line: 4 in /in/4gvfZ on line 12 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <meta http-equiv="content-type" content="text/html; charset=iso-8859-7"></head></html>
Output for 7.3.32 - 7.3.33, 7.4.26 - 7.4.33, 8.0.13 - 8.0.29, 8.1.0 - 8.1.21, 8.2.0 - 8.2.8
Warning: DOMDocument::loadHTML(): input conversion failed due to input error, bytes 0x7A 0x7A 0x7A 0x7A in /in/4gvfZ on line 12 Warning: DOMDocument::loadHTML(): switching encoding: encoder error in Entity, line: 4 in /in/4gvfZ on line 12 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html><head><meta http-equiv="content-type" content="text/html; charset=iso-8859-7"></head></html>
Output for 5.3.3 - 5.3.29, 5.4.0 - 5.4.45, 5.5.0 - 5.5.35, 5.6.0 - 5.6.28, 7.0.0 - 7.0.20, 7.1.0 - 7.1.25, 7.2.0 - 7.2.33, 7.3.0 - 7.3.31, 7.4.0 - 7.4.25, 8.0.0 - 8.0.12
Warning: DOMDocument::loadHTML(): input conversion failed due to input error, bytes 0xAE 0x7A 0x7A 0x7A in /in/4gvfZ on line 12 Warning: DOMDocument::loadHTML(): input conversion failed due to input error, bytes 0xAE 0x7A 0x7A 0x7A in /in/4gvfZ on line 12 Warning: DOMDocument::loadHTML(): htmlCheckEncoding: encoder error in Entity, line: 4 in /in/4gvfZ on line 12 Warning: DOMDocument::loadHTML(): input conversion failed due to input error, bytes 0xAE 0x7A 0x7A 0x7A in /in/4gvfZ on line 12 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html><head><meta http-equiv="content-type" content="text/html; charset=iso-8859-7"><title>test</title></head><body><p>aaaaa</p></body></html>
Output for 5.1.0 - 5.1.6, 5.2.0 - 5.2.17, 5.3.0 - 5.3.2
Warning: DOMDocument::loadHTML(): input conversion failed due to input error, bytes 0xAE 0x7A 0x7A 0x7A in /in/4gvfZ on line 12 Warning: DOMDocument::loadHTML(): input conversion failed due to input error, bytes 0xAE 0x7A 0x7A 0x7A in /in/4gvfZ on line 12 Warning: DOMDocument::loadHTML(): htmlCheckEncoding: encoder error in Entity, line: 4 in /in/4gvfZ on line 12 Warning: DOMDocument::loadHTML(): input conversion failed due to input error, bytes 0xAE 0x7A 0x7A 0x7A in /in/4gvfZ on line 12 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <meta http-equiv="content-type" content="text/html; charset=iso-8859-7"> <title>test</title> </head> <body><p>aaaaa</p></body> </html>
Output for 5.0.0 - 5.0.5
Warning: input conversion failed due to input error, bytes 0xAE 0x7A 0x7A 0x7A in /in/4gvfZ on line 12 Warning: input conversion failed due to input error, bytes 0xAE 0x7A 0x7A 0x7A in /in/4gvfZ on line 12 Warning: DOMDocument::loadHTML(): htmlCheckEncoding: encoder error in Entity, line: 4 in /in/4gvfZ on line 12 Warning: input conversion failed due to input error, bytes 0xAE 0x7A 0x7A 0x7A in /in/4gvfZ on line 12 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <meta http-equiv="content-type" content="text/html; charset=iso-8859-7"> <title>test</title> </head> <body><p>aaaaa</p></body> </html>
Output for 4.3.2 - 4.3.11, 4.4.0 - 4.4.9
Fatal error: Cannot instantiate non-existent class: domdocument in /in/4gvfZ on line 11
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Cannot instantiate non-existent class: domdocument in /in/4gvfZ on line 11

preferences:
249.26 ms | 401 KiB | 360 Q