3v4l.org

run code in 300+ PHP versions simultaneously
<?php function getColor($domnode) { while($domnode->parentNode) { if ($domnode->parentNode->getAttribute('color')) { return $domnode->parentNode->getAttribute('color'); } } } $html = '<FONT FACE="League" SIZE="15" COLOR="#000000"><font COLOR="#ff00ff" SIZE="18"><b><font SIZE="23"><font SIZE="27"><font SIZE="23"><font SIZE="18"><font SIZE="23">Moet Flip make-up dragen? <br />Stem mee in de poll!!</font></font></font></font></font></b></font><br /></FONT>'; $dom = new DOMDOcument(); $dom->loadHTML($html); $xpath = new DOMXPath($dom); $nodes = $xpath->evaluate("/html/body//text()"); foreach ($nodes as $node) { $color = getColor($node); var_dump($color); if ($color) { $span = $document->createElement('span'); $span->setAttribute('style', 'color: ' . $color . ';'); var_dump($node); $node->parentNode->replaceChild($span, $node); } } var_dump($dom->saveHTML());
Output for git.master, git.master_jit, rfc.property-hooks

Process exited with code 137.

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