嗯...如何在调用 preg_replace 时使用变量?
这没有用:
foreach($numarray as $num => $text)
{
$patterns[] = '/<ces>(.*?)\+$num(.*?)<\/ces>/';
$replacements[] = '<ces>$1<$text/>$2</ces>';
}
是的,$num
前面有一个加号。是的,我想“ tag the $num as <$text/>
”。