3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?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) . chr(0xE3) . chr(0x80) . chr(0x90) .chr(0xE8) . 'zzzzz</p></body> </html>'; $content = utf8_encode( $str ); $xml = new DOMDocument(); $xml->loadHTML($content); echo @$xml->saveHTML();
based on gg1I8
Output for 5.3.3 - 7.2.0
Warning: DOMDocument::loadHTML(): input conversion failed due to input error, bytes 0xAE 0xC3 0xA3 0xC2 in /in/4H7M7 on line 16 Warning: DOMDocument::loadHTML(): input conversion failed due to input error, bytes 0xAE 0xC3 0xA3 0xC2 in /in/4H7M7 on line 16 Warning: DOMDocument::loadHTML(): htmlCheckEncoding: encoder error in Entity, line: 4 in /in/4H7M7 on line 16 Warning: DOMDocument::loadHTML(): input conversion failed due to input error, bytes 0xAE 0xC3 0xA3 0xC2 in /in/4H7M7 on line 16 <!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.3.2
Warning: DOMDocument::loadHTML(): input conversion failed due to input error, bytes 0xAE 0xC3 0xA3 0xC2 in /in/4H7M7 on line 16 Warning: DOMDocument::loadHTML(): input conversion failed due to input error, bytes 0xAE 0xC3 0xA3 0xC2 in /in/4H7M7 on line 16 Warning: DOMDocument::loadHTML(): htmlCheckEncoding: encoder error in Entity, line: 4 in /in/4H7M7 on line 16 Warning: DOMDocument::loadHTML(): input conversion failed due to input error, bytes 0xAE 0xC3 0xA3 0xC2 in /in/4H7M7 on line 16 <!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 0xC3 0xA3 0xC2 in /in/4H7M7 on line 16 Warning: input conversion failed due to input error, bytes 0xAE 0xC3 0xA3 0xC2 in /in/4H7M7 on line 16 Warning: DOMDocument::loadHTML(): htmlCheckEncoding: encoder error in Entity, line: 4 in /in/4H7M7 on line 16 Warning: input conversion failed due to input error, bytes 0xAE 0xC3 0xA3 0xC2 in /in/4H7M7 on line 16 <!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.4.9
Fatal error: Cannot instantiate non-existent class: domdocument in /in/4H7M7 on line 15
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Cannot instantiate non-existent class: domdocument in /in/4H7M7 on line 15