3v4l.org

run code in 300+ PHP versions simultaneously
<?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.3.20, 5.4.0 - 5.4.10
Parse error: syntax error, unexpected ',' in /in/sm5ft on line 24
Process exited with code 255.

preferences:
173.14 ms | 1395 KiB | 39 Q