The error I get is: “Parameter mismatch, pattern is a string while replacement is an array”, though the previous code works fine.
The objective is to replace with values the tags enclosed by % in a template for an email. They are replaced with values from the $VAR array, so first we have:
reset($VAR);
while(list($key, $value) = each($VAR))
{
$re_this = “%var_”.$key.“%”;
$replace[$re_this] = $value;
}
Thanks for your interest, I can confirm that all I need to do is change the three preg_replace lines back to previous and the script works absolutely fine. Weird.