3v4l.org

run code in 300+ PHP versions simultaneously
<?php $totalPages = 3; $xml = new DomDocument('1.0', 'UTF-8'); $xml->formatOutput = true; $html = $xml->createElement('html'); $xml->appendChild($html); $wrapper = $xml->createElement('div'); $wrapper->setAttribute('class', 'wrapper'); $html->appendChild($wrapper); $pages = []; for ($i=1; $i <= $totalPages ; $i++) { $page = $xml->createElement('div'); $page->setAttribute('class', 'pages'); $page->setAttribute( 'id', 'page-' . $i ); $wrapper->appendChild($page); $pages[] = $page; } $wrapper->appendChild($page); $pages[0]->nodeValue = 'Content page-1'; $pages[1]->nodeValue = 'Content page-2'; $pages[2]->nodeValue = 'Content page-3'; echo $xml->saveHTML();
Output for git.master, git.master_jit, rfc.property-hooks
<html><div class="wrapper"> <div class="pages" id="page-1">Content page-1</div> <div class="pages" id="page-2">Content page-2</div> <div class="pages" id="page-3">Content page-3</div> </div></html>

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
175.99 ms | 405 KiB | 5 Q