3v4l.org

run code in 300+ PHP versions simultaneously
<?php $html = <<<HTML <div> <p> some text <a href="../plugins/re_records/somefile.php?page=something&id=345">find_me_1</a></p> <br> <a href="../plugins/re_records/somefile.php?page=something&id=99">find_me_2</a> <div> <div> <a href="example.com?page=something&id=55">don't even think about it!</a> <a href="../plugins/re_records/somefile.php?page=something&id=90210">find_me_3</a> </div> </div> </div> HTML; $hrefStartsWith = '../plugins/re_records/somefile.php?page=something&id='; $dom = new DOMDocument(); libxml_use_internal_errors(true); $dom->loadHTML($html, LIBXML_HTML_NODEFDTD | LIBXML_HTML_NOIMPLIED); $xpath = new DOMXPath($dom); foreach ($xpath->query("//a[starts-with(@href, '$hrefStartsWith')]") as $a) { $a->setAttribute('href', '/map/' . $a->nodeValue); } echo $dom->saveHTML();
Output for 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 - 8.5.1
<div> <p> some text <a href="/map/find_me_1">find_me_1</a></p> <br> <a href="/map/find_me_2">find_me_2</a> <div> <div> <a href="example.com?page=something&amp;id=55">don't even think about it!</a> <a href="/map/find_me_3">find_me_3</a> </div> </div> </div>
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:
194.53 ms | 407 KiB | 5 Q