【发布时间】:2010-11-23 01:20:17
【问题描述】:
好的,所以我有这个 PHP 脚本:
<?php
$stringz = "Dan likes to eat pears and his favorite color is green!";
$patterns = array("/pears/","/green/");
$string = preg_replace($patterns, '<b>\\1</b>', $stringz);
echo "<textarea rows='30' cols='100'>$string</textarea>";
?>
当我运行它时,我得到了这个:
Dan likes to eat <b></b> and his favorite color is <b></b>!
应该有一个单词...但它没有...
【问题讨论】:
标签: php preg-replace