3v4l.org

run code in 300+ PHP versions simultaneously
<?php $content = ' <span id="pass_AwfpSYYUsn" data-id="AwfpSYYUsn" class="pointer unlockFieldChild" data-client="51" data-status="closed"><i class="fa fa-lock"></i> Show</span> <!-- OTHER HTML STUFF --> <span id="pass_DbTD7TjEDX" data-id="DbTD7TjEDX" class="pointer unlockFieldChild" data-client="51" data-status="closed"><i class="fa fa-lock"></i> Show</span> '; $dom = new DOMDocument; $state = libxml_use_internal_errors(true); $dom->loadHTML('<div id="root">' . $content . '</div>'); $xp = new DOMXPath($dom); $nodeList = $xp->query('//span[starts-with(@id, "pass_")]'); foreach ($nodeList as $node) { $idpass = explode('_', $node->getAttribute('id'), 2)[1]; $pw = 'Free sauerkraut for all!'; /* This checks and fills the password, not really relvant to the question */ /* if ($aG->getCanPassword()) { $p = $em->getRepository('AppBundle:PasswordList')->findOneBy(['code' => $idpass]); if ($p !== null) { $pw = $p->getPass(); } }*/ $textNode = $dom->createTextNode('[pass id="' . $idpass . '"]' . $pw . '[/pass]'); $node->parentNode->replaceChild($textNode, $node); } $content = ''; foreach($dom->getElementById('root')->childNodes as $childNode) { $content .= $dom->saveHTML($childNode); } libxml_use_internal_errors($state); echo $content;
Output for git.master, git.master_jit, rfc.property-hooks
[pass id="AwfpSYYUsn"]Free sauerkraut for all![/pass] <!-- OTHER HTML STUFF --> [pass id="DbTD7TjEDX"]Free sauerkraut for all![/pass]

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:
39.35 ms | 405 KiB | 5 Q