如何在HTML textarea输出中查找和转换使用大括号{site_name}的字符串?

I am designing a Mail Template editor in my application. I need an idea to find the occurance of specific variables to be able to convert them using preg_replace or preg_match in my code.

For example, my template looks like this: (Sample only) this is what is returned from the textarea variable.

<p>Thank you for your order at <a href="{site_url}" style="color:#ea6ea0">{site_name}</a>.</p>

In this example, I would like to replace the {site_url} with a specific variable or code from PHP since I can't parse PHP directly into the textarea.

Hope my question was clear, any help appreciated.

Edit: Is my question clear? I need to replace the {} strings using my own php code. The php code cann't be used in textarea directly. That is why i need to find a templating system that replace predefined variables {... } but convert them using php when interpreting the template.

Do you mean something like this?

<p>Thank you for your order at <a href="<?=$site_url?>" style="color:#ea6ea0"><?=$site_name?></a>.</p>

or

<p>Thank you for your order at <a href="<?php echo $site_url?>" style="color:#ea6ea0"><?php echo $site_name?></a>.</p>

edited:

Ahhh, do you mean something like this then:

$html = '<p>Thank you for your order at <a href="{site_url}" style="color:#ea6ea0">{site_name}</a>.</p>';

$php_variables_array = array(
  "site_url" => "http://www.google.co.uk",
  "site_name" => "Google",
);

foreach ($php_variables_array as $key => $value)
{
  $html = str_replace("{" . $key . "}", $value, $html);
}

echo $html;
 <a href="<?php echo $site_url;?>" style="color:#ea6ea0"><?php echo $site_name;?></a>