3v4l.org

run code in 300+ PHP versions simultaneously
<?php function do_it($in) { $a = new DOMDocument(); $a->loadHTML($in); $xpath = new DOMXpath($a); foreach($xpath->query('/html/body//ul') as $node) _handle_uls($node); return $a->textContent; } function _handle_uls(DOMNode $node) { echo 'Works:' . "\n\n"; foreach ($node->childNodes as $subnode) echo '* ' . trim($subnode->textContent) . "\n"; echo "\n\n\n" . 'Problems:' . "\n\n"; var_dump($node->nodeName); foreach ($node->childNodes as $subnode) { var_dump($subnode->nodeName); $textNode = $subnode->ownerDocument->createTextNode('* ' . trim($subnode->textContent) . "\n"); $subnode->ownerDocument->importNode($textNode); $subnode->parentNode->replaceChild($textNode, $subnode); } } $HTML = '<ul><li>Potatoes</li><li>Tomatoes</li><li>Carrots</li></ul>'; echo do_it($HTML);
Output for git.master, git.master_jit, rfc.property-hooks
Works: * Potatoes * Tomatoes * Carrots Problems: string(2) "ul" string(2) "li" * Potatoes TomatoesCarrots

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:
59.67 ms | 401 KiB | 8 Q