3v4l.org

run code in 300+ PHP versions simultaneously
<?php function reverseVisibleText($doc, $node) { $parts = []; foreach ($node->childNodes as $child) { if ($child->nodeType === XML_TEXT_NODE) { array_unshift($parts, strrev($child->nodeValue)); } elseif ($child->nodeType === XML_ELEMENT_NODE) { $child->nodeValue = reverseVisibleText($doc, $child); array_unshift($parts, $doc->saveHTML($child)); } } return implode($parts); } $html = 'The quick <font color="brown">brown</font> fox jumps over the lazy dog'; $doc = new DOMDocument(); $doc->loadHTML($html, LIBXML_HTML_NOIMPLIED | LIBXML_HTML_NODEFDTD); echo reverseVisibleText($doc, $doc->documentElement);
Output for git.master, git.master_jit, rfc.property-hooks
god yzal eht revo spmuj xof <font color="brown">nworb</font> kciuq ehT

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:
41.72 ms | 991 KiB | 4 Q