3v4l.org

run code in 300+ PHP versions simultaneously
<?php $regex = '/\{link ([0-9]+)/'; $subject = 'Hello World! {link 123456#abc}TEST{/link} Bla!'; echo preg_replace_callback($regex, function (array $matches) { var_export($matches); return $matches[1] . 'ABC'; }, $subject);

preferences:
61.72 ms | 402 KiB | 5 Q