UBB替换用户名

I am trying to replace {username} with the user name.

I've tried:

$username = htmlentities($gegevens['gebruikersnaam']);
$text = preg_replace("{username}",$username, $text);

But that didn't output the username.

My full code is this:

I am only including the bold ubb replacer, there's a full list of things to replace so I'm leaving that out.

function ubbreplace($text){
    $text = preg_replace("#\[b\](.*?)\[/b\]#si","<strong>\\1</strong>", $text);
    $text = nl2br($text);
    return $text;
}

Thanks in advance!

You could keep it simple and use str_replace instead

$username = htmlentities($gegevens['gebruikersnaam']);
$text = str_replace('{username}',$username, $text);