3v4l.org

run code in 300+ PHP versions simultaneously
<?php $text = 'say hello to @elise_123.com and @john-abc'; function replace_at_symbol($matches){ $username = str_replace("@", "", $matches[0]); return '<a href="/profile/'.$username.'">'.$matches[0].'</a>';} $output = preg_replace_callback("/([@][-_a-zA-Z-0-9]+)/", "replace_at_symbol", $text); echo $output; ?>

preferences:
41.77 ms | 402 KiB | 5 Q