【发布时间】:2015-11-17 04:32:29
【问题描述】:
由于我是初学者,请帮助解决这个问题。我尝试使用以下代码突出显示字符串中的文本,但没有得到预期的结果。
foreach($modules as $comments)
{
foreach($block_words as $k=>$v)
{
foreach($v as $n)
{
$comments['Updated'] = (preg_replace("/\b($n)\b/i","<b>$n</b>",$comments['Updated']));
}
}
}
我用过这个,但是得到了输出
What <b>you</b> trying <b>to</b> say.................. Plz <b>clear</b> and Neetttttttttt
请找出错误并帮助我解决问题。
【问题讨论】:
-
您的意见和预期结果是什么?
-
$block_words=Array ( [0] => Array ( [word] => to ) [1] => Array ( [word] => you ) [2] => Array ( [word ] => clear ) [3] => Array ( [word] => good ) ) 和 $cmets['updated']='string..........array';如果它出现在 $cmets['updated'] 中,我想突出显示块词