I want to replace a string with a corresponding value from an array. So for example:
$array=array(
'food'=>'cornbread',
'day'=>'wednesday'
);
$string='My favorite food is {food}';
This isn't right:
$string=preg_replace("/{(.*?)}/",$c[1],$string);
What is the best way to do this?