Using ucfirst() in preg_replace???

Hi,

Is it possible to convert the first letter after @ to uppercase using preg_replace? I tried;

preg_replace('/\@(\w+)/', 'ucfirst("$1")', $str)

But nothing changed when I sent it...

Already like that... It worked, but I don't know how to add the @ before the name that will be converted.

$str = '@james';
echo preg_replace_callback('/\@(\w+)/', 'up', ucfirst ($str));

function up ($matches) {
  return ucfirst ($matches[1]);
}