3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $html = "<link rel='stylesheet' href='http://www.foo.com/bar/baz.min.css' type='text/css' id='23434' foo='bar' media='all'/>"; $dom = new DOMDocument(); $dom->loadHTML($html); $link = $dom->getElementById('23434'); $link->setAttribute('foo', 'test'); echo $dom->saveXML($link); ?>
Output for 5.0.0 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
<link rel="stylesheet" href="http://www.foo.com/bar/baz.min.css" type="text/css" id="23434" foo="test" media="all"/>
Output for 4.3.2 - 4.4.9
<br /> <b>Fatal error</b>: Cannot instantiate non-existent class: domdocument in <b>/in/fZjsj</b> on line <b>4</b><br />
Process exited with code 255.
Output for 4.3.0 - 4.3.1
<br /> <b>Fatal error</b>: Cannot instantiate non-existent class: domdocument in <b>/in/fZjsj</b> on line <b>4</b><br />