You could also have some fun with the preg_replace_callback function here.
Say the text is __NAME__ or __AGE__ and it refers to $yourArray['name'] and $yourArray['age']:
You can then add as many array items and text keys as you want.
$yourArray = array('name' => 'dave', 'age' = 32);
$match = $matches;
$lmatch = strtolower($match);
return array_key_exists($lmatch, $yourArray) ? $yourArray[$lmatch] : ('__' . $match . '__');
$yourString = "Hey, I'm __AGE__ and my name is __NAME__. Nice name, don't you think?";
$yourString = preg_replace_callback('/__([A-Z\d]+)__/', 'getString', $yourString);
This can save you from having to manually search for your vars.