Ummm... how do I use variables in a call to preg_replace?
This didn't work:
foreach($numarray as $num => $text)
{
$patterns[] = '/<ces>(.*?)\+$num(.*?)<\/ces>/';
$replacements[] = '<ces>$1<$text/>$2</ces>';
}
Yes, the $num
is preceeded by a plus sign. Yes, I want to "tag the $num as <$text/>
".