3v4l.org

run code in 300+ PHP versions simultaneously
<?php $html = '<html> <head> <meta content="text/html; charset=utf-8" http-equiv="Content-Type"> </head> <body bgcolor="#FFFFFF" text="#000000"> <p>test</p> </body> </html>'; echo LIBXML_DOTTED_VERSION . PHP_EOL . PHP_EOL; $dom = new DOMDocument(); $dom->formatOutput = false; $dom->loadHTML($html); echo $dom->saveHTML($dom->documentElement) . PHP_EOL . PHP_EOL; echo $dom->saveHTML() . PHP_EOL . PHP_EOL; $dom = new DOMDocument(); $dom->formatOutput = false; $dom->loadHTML($html, LIBXML_PARSEHUGE); echo $dom->saveHTML($dom->documentElement) . PHP_EOL . PHP_EOL; echo $dom->saveHTML() . PHP_EOL . PHP_EOL;
Output for 7.3.0 - 7.3.28, 7.4.0 - 7.4.21, 8.0.0 - 8.0.8
2.9.4 <html><head><meta content="text/html; charset=utf-8" http-equiv="Content-Type"></head><body bgcolor="#FFFFFF" text="#000000"> <p>test</p> </body></html> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd"> <html><head><meta content="text/html; charset=utf-8" http-equiv="Content-Type"></head><body bgcolor="#FFFFFF" text="#000000"> <p>test</p> </body></html> <html> <head> <meta content="text/html; charset=utf-8" http-equiv="Content-Type"> </head> <body bgcolor="#FFFFFF" text="#000000"> <p>test</p> </body> </html> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd"> <html> <head> <meta content="text/html; charset=utf-8" http-equiv="Content-Type"> </head> <body bgcolor="#FFFFFF" text="#000000"> <p>test</p> </body> </html>
Output for 7.1.25 - 7.1.33, 7.2.0 - 7.2.33
2.9.4 <html> <head><meta content="text/html; charset=utf-8" http-equiv="Content-Type"></head> <body bgcolor="#FFFFFF" text="#000000"> <p>test</p> </body> </html> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd"> <html><head><meta content="text/html; charset=utf-8" http-equiv="Content-Type"></head><body bgcolor="#FFFFFF" text="#000000"> <p>test</p> </body></html> <html> <head> <meta content="text/html; charset=utf-8" http-equiv="Content-Type"> </head> <body bgcolor="#FFFFFF" text="#000000"> <p>test</p> </body> </html> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd"> <html> <head> <meta content="text/html; charset=utf-8" http-equiv="Content-Type"> </head> <body bgcolor="#FFFFFF" text="#000000"> <p>test</p> </body> </html>

preferences:
446.67 ms | 463 KiB | 5 Q