3v4l.org

run code in 300+ PHP versions simultaneously
<?php $message = '<a href="https://www.domain.nl/internet" target="_blank" title="https://www.domain.nl/internet">https://www.domain.nl/internet</a>'; $message = preg_replace_callback('~\shref=[\'"]\Khttps?://www\.domain\.nl(?:/[^\s"\'<>]*)?~i', function($matches) { return 'https://www.affiliatedomain.com/cread.php?id=1234&amp;affid=12345&amp;clickref=me&amp;p=' . urlencode('[[' . $matches[0] . ']]'); }, $message); echo $message; // =%5B%5Bhttps%3A%2F%2Fwww.domain.nl%2Finternet%5D%5D

preferences:
31.06 ms | 405 KiB | 5 Q