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>"; $xml = preg_replace('/<CONTENT\/>/',$content,$xml,1); $xml = preg_replace('/<HEADER\/>/',$header,$xml,1); $xml = preg_replace('/<FOOTER\/>/',$footer,$xml,1); echo $xml;
Output for 4.3.0 - 7.1.0
<html> <head><title>page 1</title></head> <body> <ul><li><a href="page2">page2</a><li></ul> <div id='main'>asdf asdf</div> </body> <script type='text/javascript'></script> </html>