【发布时间】:2010-11-26 21:52:05
【问题描述】:
嗯...如何在调用 preg_replace 时使用变量?
这不起作用:
foreach($numarray as $num => $text)
{
$patterns[] = '/<ces>(.*?)\+$num(.*?)<\/ces>/';
$replacements[] = '<ces>$1<$text/>$2</ces>';
}
是的,$num 前面有一个加号。是的,我想“tag the $num as <$text/>”。
【问题讨论】:
标签: php variables preg-replace