3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $xml = <<<XML <html> <head><HEADER/></head> <body> <ul> <li><a href="page2">page2</a> </li> </ul> <CONTENT/> </body> <FOOTER/> </html> XML; $content = "<div id='main'>asdf asdf</div>"; $header = "<title>page 1</title>"; $footer = "<script type='text/javascript'></script>"; $doc = new DOMDocument(); $doc->loadXML($xml); $xp = new DOMXPath($doc); $ctag = $doc->getElementsByTagName("CONTENT")->item(0); $ctag->parentNode->replaceChild(new DOMCdataSection($content)),$ctag); echo $doc->saveHTML();
Output for 5.3.0 - 5.4.10
Parse error: syntax error, unexpected ',' in /in/QYu9r on line 24
Process exited with code 255.