3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $text = 'say hello to @elise and @john'; function replace_at_symbol($matches){ str_replace("@", "", $matches[0]); return '<a href="/profile/'.$matches[0].'">'.$matches[0].'</a>';} $output = preg_replace_callback("/([@][a-zA-Z-0-9]+)/", "replace_at_symbol", $text); echo $output; ?>
based on KYJRC
Output for 4.3.0 - 7.1.0
say hello to <a href="/profile/@elise">@elise</a> and <a href="/profile/@john">@john</a>