3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php function tidyHTML($buffer) { // load our document into a DOM object $dom = new DOMDocument(); // we want nice output $dom->preserveWhiteSpace = false; $dom->loadHTML($buffer); $dom->formatOutput = true; return($dom->saveHTML()); } echo tidyHTML(' <!DOCTYPE html> <html class="nojs"> <head> <title> Bitly. The power of the link. </title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta content="IE=edge" http-equiv="X-UA-Compatible"> <meta name="keywords" content="bitly, awesome, save, share, shorten" /> <meta name="description" content="Bitly. The power of the link." /> <meta name="viewport" content="width=device-width,minimum-scale=1.0, maximum-scale=1.0, user-scalable=no"> <script type="text/javascript"> // remove nojs from html try{ document.getElementsByTagName("html")[0].className = ""; } catch (ex) { } </script> <link href="//d1ayxb9ooonjts.cloudfront.net/8445e417ef5a6402f5ddd26caa4e1da5.css" rel="stylesheet" type="text/css"> <link href="//d3h5jhobc20ump.cloudfront.net/2e907b3335b17d64aea95955710c394d.css" rel="stylesheet" type="text/css"> <!--[if lte IE 8]> <link href="//d3h5jhobc20ump.cloudfront.net/f521cb9cec0171e8d913538552d98b10.css" rel="stylesheet" type="text/css"> <![endif]--> <link rel="icon" type="image/png" href="//d1ayxb9ooonjts.cloudfront.net/22f1d0b2154c2f58baf06f92038d262a.png" /> <!--[if lte IE 8]> <script src="//dl6fh5ptkejqa.cloudfront.net/1b67aa02ef18dd3ce7e428f8c18a339a.js" type="text/javascript"></script> <![endif]--> </head> <body class="hamburger signed-out-homepage logged-out"> <div class="ext_bitly_chrome_promo_delay promo"> </div> <div id="main"> <div id="sidebar"> <div class="nav"> <ul> <li class="has-right-bullet"><a href="/pages/about">About</a></li> <li class="has-right-bullet"><a href="http://dev.bitly.com">API</a></li> <li><a href="/a/support">Help</a></li> <li class="has-right-bullet"><a href="/a/support" class="uservoice-feedback-link">Contact</a></li> <li><a href="http://blog.bitly.com">Company Blog</a></li> <li><a href="http://word.bitly.com">Engineering Blog</a></li> <li><a href="/pages/jobs">Jobs <span class="callout-label">Hiring!</span></a></li> </ul> <div class="nav-separator"></div> <div class="ext-nav"> <ul class="social-media ext"> <li><a href="//facebook.com/bitly"><i class="fa fa-facebook-square footer-fb"></i></a></li> <li><a href="//twitter.com/bitly"><i class="fa fa-twitter-square footer-tw"></i></a></li> </ul> <a href="/a/mobile" class="mobile_promo"><i class="fa fa-apple"></i> iPhone</a> </div> </div> </div> <div id="container" class="clearfix"> <div class="shorten-wrapper"> <div class="shorten-wrapper-content superwide"> <img id="logo" class="show-large-only logo-header" alt="bitly" src="//d1ayxb9ooonjts.cloudfront.net/b71e37605e0fa7d8535bdaff63770c20.png"> <div id="form_plus_copy_container"> <div id="form_container"><form method="POST" action="/shorten/" name="shortenUrl" id="unAuthShortenForm"> <fieldset class="cf"> <i class="fa fa-fw fa-chain inset-shorten hamburger-hide"></i> <input id="shorten_url" taborder="1" name="url" type="text" class="text" placeholder="Paste a link to shorten it" value="" autocomplete="off" autocorrect="off" autocapitalize="off" /> <input id="shorten_btn" type="submit" class="btn blue-btn square" value="Shorten" /> <input type="hidden" name="basic_style" value="1"> <input type="hidden" name="classic_mode" value=""> <!-- allow rapid shorten --> <input type="hidden" name="rapid_shorten_mode" value=""> <form action="" method="get"> <input type="hidden" name="_xsrf" value="9b32a7b07c52473c94f2e843980bd397"/> </form> </fieldset> </form></div> <span class="show-large-only external_susi sign-up-header"> <strong>Take control of your links,</strong> <a href="/a/sign_up">sign up for free.</a> </span> <span id="signup-links" class="show-large-only external_susi sign-in-header"> <a href="/a/sign_in">Sign in</a> </span> </div> </div> </div> <div class="promo-container"> <div id="signup-links" class="show-small-only external_susi"> <img id="logo" alt="bitly" class="show-small-only promo-center" src="//d1ayxb9ooonjts.cloudfront.net/b71e37605e0fa7d8535bdaff63770c20.png"> <br/> <strong>Take control of your links,</strong><br/> <a href="/a/sign_up">sign up for free.</a> <br/> <a href="/a/sign_in">Sign in</a> </div> <div class="promo-tile devices"> <div class="maintain-aspect mt20"> <img class="promo-image max-all" src="//d1ayxb9ooonjts.cloudfront.net/e3883311785abbe4bfbe185fa5b13a7c.png"> </div> </div> <div class="promo-tile promo-tile--enterprise tile-l"> <h1 class="title_orange">Bitly Brand Tools</h1> <p class="tagline"> <strong>Bitly Brand Tools</strong> are the must-have for marketers to fuel branding, engagement, and understanding in the connected world. </p> <a class="btn square secondary" href="/a/features"> Learn More </a> <div class="headroom text-large"> Trying to shorten a link? <a href="/a/sign_up" class="title_orange">Click here.</a></div> </div> </div> </div> <div id="fw-container" class="c2 clearfix"> <div id="container" class="clearfix c2"> <div class="promo-tile tile-r" id="media-map"> <div class="maintain-aspect mv20"> <h1 class="title_orange mmf">The Bitly Real-Time Media Map</h1> <div alt="rt" class="mm-pin"></div> <p class="tagline"> See who is consuming what media<br/>where in the United States, in real-time! </p> <a class="btn square secondary" href="/a/media_map"> View Now </a> </div> </div> </div> <div id="bottom"> <form action="" method="get"> <input type="hidden" name="_xsrf" value="9b32a7b07c52473c94f2e843980bd397"/> </form> </div> </div> </div> <div id="our-clients" class="clear"> <h1 class="title_black">Our Clients</h1> <p class="tagline"> Sometimes it\'s better to let our clients do the talking. </p> <div id="testimonials"> <img class="testimonial_logo" src="//dl6fh5ptkejqa.cloudfront.net/dfef6f3701605ebbb40097ff6fc270a8.png"> <div id="testimonial1"> <p class="testimonial_logo"> "My favorite thing about Bitly is how I can track our performance with literally one click." <br/> <span class="testimonial_source"> -Liz Kennedy, Social Media Manager, iVillage</span> </p> </div> </div> </div> <div id="footer"> <img class="clients-image" src="//d3h5jhobc20ump.cloudfront.net/db898a50bb145d2b3b8cf42d894da2a2.png"> <div class="large-headroom large-footroom"><a href="http://bitly.com/getstartedform" class="button square secondary lg-button">Get Started</a></div> <div class="footer-link-wrapper text-center"> <ul id="footer_links" class="clearfix"> <li><a href="/a/support">Help</a></li> <li><a href="/a/support" class="uservoice-feedback-link">Contact</a></li> <li><a href="http://dev.bitly.com/">Developers</a></li> <li><a href="/pages/jobs">Jobs</a></li> <li><a href="/pages/about">About</a></li> <li><a href="http://blog.bitly.com/">Blog</a></li> </ul> <p class="copyright">&copy; 2014 Bitly&trade; &middot; handmade in NYC</p> <div class="signedout-homepage social-media"> <span><a href="//facebook.com/bitly"><i class="fa fa-facebook-square footer-fb"></i></a></span> <span><a href="//twitter.com/bitly"><i class="fa fa-twitter-square footer-tw"></i></a></span> <span><a href="//linkedin.com/company/552285?trk=tyah"><i class="fa fa-linkedin-square footer-linkedin"></i></a></span> <span><a href="//plus.google.com/110480996269032856302"><i class="fa fa-google-plus-square footer-google-plus"></i></a></span> </div> </div> </div> <script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js"></script> </body> </html> ');
Output for 5.0.0 - 7.1.0
Warning: DOMDocument::loadHTML(): ID signup-links already defined in Entity, line: 111 in /in/KlImp on line 7 Warning: DOMDocument::loadHTML(): ID logo already defined in Entity, line: 112 in /in/KlImp on line 7 Warning: DOMDocument::loadHTML(): ID container already defined in Entity, line: 137 in /in/KlImp on line 7 <!DOCTYPE html> <html class="nojs"> <head> <title> Bitly. The power of the link. </title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <meta content="IE=edge" http-equiv="X-UA-Compatible"> <meta name="keywords" content="bitly, awesome, save, share, shorten"> <meta name="description" content="Bitly. The power of the link."> <meta name="viewport" content="width=device-width,minimum-scale=1.0, maximum-scale=1.0, user-scalable=no"> <script type="text/javascript"> // remove nojs from html try{ document.getElementsByTagName("html")[0].className = ""; } catch (ex) { } </script><link href="//d1ayxb9ooonjts.cloudfront.net/8445e417ef5a6402f5ddd26caa4e1da5.css" rel="stylesheet" type="text/css"> <link href="//d3h5jhobc20ump.cloudfront.net/2e907b3335b17d64aea95955710c394d.css" rel="stylesheet" type="text/css"> <!--[if lte IE 8]> <link href="//d3h5jhobc20ump.cloudfront.net/f521cb9cec0171e8d913538552d98b10.css" rel="stylesheet" type="text/css"> <![endif]--><link rel="icon" type="image/png" href="//d1ayxb9ooonjts.cloudfront.net/22f1d0b2154c2f58baf06f92038d262a.png"> <!--[if lte IE 8]> <script src="//dl6fh5ptkejqa.cloudfront.net/1b67aa02ef18dd3ce7e428f8c18a339a.js" type="text/javascript"></script> <![endif]--> </head> <body class="hamburger signed-out-homepage logged-out"> <div class="ext_bitly_chrome_promo_delay promo"> </div> <div id="main"> <div id="sidebar"> <div class="nav"> <ul> <li class="has-right-bullet"><a href="/pages/about">About</a></li> <li class="has-right-bullet"><a href="http://dev.bitly.com">API</a></li> <li><a href="/a/support">Help</a></li> <li class="has-right-bullet"><a href="/a/support" class="uservoice-feedback-link">Contact</a></li> <li><a href="http://blog.bitly.com">Company Blog</a></li> <li><a href="http://word.bitly.com">Engineering Blog</a></li> <li><a href="/pages/jobs">Jobs <span class="callout-label">Hiring!</span></a></li> </ul> <div class="nav-separator"></div> <div class="ext-nav"> <ul class="social-media ext"> <li><a href="//facebook.com/bitly"><i class="fa fa-facebook-square footer-fb"></i></a></li> <li><a href="//twitter.com/bitly"><i class="fa fa-twitter-square footer-tw"></i></a></li> </ul> <a href="/a/mobile" class="mobile_promo"><i class="fa fa-apple"></i> iPhone</a> </div> </div> </div> <div id="container" class="clearfix"> <div class="shorten-wrapper"> <div class="shorten-wrapper-content superwide"> <img id="logo" class="show-large-only logo-header" alt="bitly" src="//d1ayxb9ooonjts.cloudfront.net/b71e37605e0fa7d8535bdaff63770c20.png"><div id="form_plus_copy_container"> <div id="form_container"><form method="POST" action="/shorten/" name="shortenUrl" id="unAuthShortenForm"> <fieldset class="cf"> <i class="fa fa-fw fa-chain inset-shorten hamburger-hide"></i> <input id="shorten_url" taborder="1" name="url" type="text" class="text" placeholder="Paste a link to shorten it" value="" autocomplete="off" autocorrect="off" autocapitalize="off"><input id="shorten_btn" type="submit" class="btn blue-btn square" value="Shorten"><input type="hidden" name="basic_style" value="1"><input type="hidden" name="classic_mode" value=""><!-- allow rapid shorten --><input type="hidden" name="rapid_shorten_mode" value=""><form action="" method="get"> <input type="hidden" name="_xsrf" value="9b32a7b07c52473c94f2e843980bd397"> </form> </fieldset> </form></div> <span class="show-large-only external_susi sign-up-header"> <strong>Take control of your links,</strong> <a href="/a/sign_up">sign up for free.</a> </span> <span id="signup-links" class="show-large-only external_susi sign-in-header"> <a href="/a/sign_in">Sign in</a> </span> </div> </div> </div> <div class="promo-container"> <div id="signup-links" class="show-small-only external_susi"> <img id="logo" alt="bitly" class="show-small-only promo-center" src="//d1ayxb9ooonjts.cloudfront.net/b71e37605e0fa7d8535bdaff63770c20.png"><br><strong>Take control of your links,</strong><br><a href="/a/sign_up">sign up for free.</a> <br><a href="/a/sign_in">Sign in</a> </div> <div class="promo-tile devices"> <div class="maintain-aspect mt20"> <img class="promo-image max-all" src="//d1ayxb9ooonjts.cloudfront.net/e3883311785abbe4bfbe185fa5b13a7c.png"> </div> </div> <div class="promo-tile promo-tile--enterprise tile-l"> <h1 class="title_orange">Bitly Brand Tools</h1> <p class="tagline"> <strong>Bitly Brand Tools</strong> are the must-have for marketers to fuel branding, engagement, and understanding in the connected world. </p> <a class="btn square secondary" href="/a/features"> Learn More </a> <div class="headroom text-large"> Trying to shorten a link? <a href="/a/sign_up" class="title_orange">Click here.</a> </div> </div> </div> </div> <div id="fw-container" class="c2 clearfix"> <div id="container" class="clearfix c2"> <div class="promo-tile tile-r" id="media-map"> <div class="maintain-aspect mv20"> <h1 class="title_orange mmf">The Bitly Real-Time Media Map</h1> <div alt="rt" class="mm-pin"></div> <p class="tagline"> See who is consuming what media<br>where in the United States, in real-time! </p> <a class="btn square secondary" href="/a/media_map"> View Now </a> </div> </div> </div> <div id="bottom"> <form action="" method="get"> <input type="hidden" name="_xsrf" value="9b32a7b07c52473c94f2e843980bd397"> </form> </div> </div> </div> <div id="our-clients" class="clear"> <h1 class="title_black">Our Clients</h1> <p class="tagline"> Sometimes it's better to let our clients do the talking. </p> <div id="testimonials"> <img class="testimonial_logo" src="//dl6fh5ptkejqa.cloudfront.net/dfef6f3701605ebbb40097ff6fc270a8.png"><div id="testimonial1"> <p class="testimonial_logo"> "My favorite thing about Bitly is how I can track our performance with literally one click." <br><span class="testimonial_source"> -Liz Kennedy, Social Media Manager, iVillage</span> </p> </div> </div> </div> <div id="footer"> <img class="clients-image" src="//d3h5jhobc20ump.cloudfront.net/db898a50bb145d2b3b8cf42d894da2a2.png"><div class="large-headroom large-footroom"><a href="http://bitly.com/getstartedform" class="button square secondary lg-button">Get Started</a></div> <div class="footer-link-wrapper text-center"> <ul id="footer_links" class="clearfix"> <li><a href="/a/support">Help</a></li> <li><a href="/a/support" class="uservoice-feedback-link">Contact</a></li> <li><a href="http://dev.bitly.com/">Developers</a></li> <li><a href="/pages/jobs">Jobs</a></li> <li><a href="/pages/about">About</a></li> <li><a href="http://blog.bitly.com/">Blog</a></li> </ul> <p class="copyright">© 2014 Bitly™ · handmade in NYC</p> <div class="signedout-homepage social-media"> <span><a href="//facebook.com/bitly"><i class="fa fa-facebook-square footer-fb"></i></a></span> <span><a href="//twitter.com/bitly"><i class="fa fa-twitter-square footer-tw"></i></a></span> <span><a href="//linkedin.com/company/552285?trk=tyah"><i class="fa fa-linkedin-square footer-linkedin"></i></a></span> <span><a href="//plus.google.com/110480996269032856302"><i class="fa fa-google-plus-square footer-google-plus"></i></a></span> </div> </div> </div> <script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js"></script> </body> </html>
Output for 4.3.2 - 4.4.9
Fatal error: Cannot instantiate non-existent class: domdocument in /in/KlImp on line 4
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Cannot instantiate non-existent class: domdocument in /in/KlImp on line 4