嗯......我如何在調用preg_replace時使用變量?
這不起作用:
foreach($numarray as $num => $text)
{
$patterns[] = '/<ces>(.*?)\+$num(.*?)<\/ces>/';
$replacements[] = '<ces>$1<$text/>$2</ces>';
}
是的,$num
由加號preceeded。是的,我想要「tag the $num as <$text/>
」。
感謝Gumbo,Paul - 您的投入都有幫助! – Steve 2009-09-09 16:56:58