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 5.6.38, 7.0.0 - 7.0.33, 7.1.0 - 7.1.25, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.33, 8.2.0 - 8.2.29, 8.3.0 - 8.3.28, 8.4.1 - 8.4.14, 8.5.0
[pass id="AwfpSYYUsn"]Free sauerkraut for all![/pass] <!-- OTHER HTML STUFF --> [pass id="DbTD7TjEDX"]Free sauerkraut for all![/pass]
Output for 8.4.15
/bin/php-8.4.15: /usr/lib/libm.so.6: version `GLIBC_2.38' not found (required by /bin/php-8.4.15) /bin/php-8.4.15: /usr/lib/libm.so.6: version `GLIBC_2.35' not found (required by /bin/php-8.4.15) /bin/php-8.4.15: /usr/lib/libc.so.6: version `GLIBC_2.34' not found (required by /bin/php-8.4.15) /bin/php-8.4.15: /usr/lib/libc.so.6: version `GLIBC_2.38' not found (required by /bin/php-8.4.15)
Process exited with code 1.

preferences:
183.55 ms | 407 KiB | 5 Q