Question: I want to make an email template and how to replace everything in the brackets `{}`and with the brackets`{}`?

```
$template = "My name is {NAME}. I'm {AGE} years old.";
$template = preg_replace("{NAME}", "Tom", $template);
$template = preg_replace("{AGE}", "10", $template);

```

and after that should look like this:
**My name is Tom. I'm 10 years old.**

Answer: 
Use `str_replace` instead of `preg_replace`:

```
$template = "My name is {NAME}. I'm {AGE} years old.";
$template = str_replace("{NAME}", "Tom", $template);
$template = str_replace("{AGE}", "10", $template);

```
Regex pattern should have delimiter at start and end of it

```
$template = "My name is {NAME}. I'm {AGE} years old.";
$template = preg_replace("/{NAME}/", "Tom", $template);
echo $template = preg_replace("/{AGE}/", "10", $template);

```