我已经处理了一段时间,但我无法弄清楚如何在 PHP 中执行以下操作:
$string = "this is test <pre>somrthing in <p>pharagraph</p></pre> dont know tell me <pre>value33 kooo ok</pre> this is php regress <pre>teeth value</pre> ok how";
function get_innercode($string) {
preg_match_all("#<pre>(.*?)</pre>#", $string, $foo);
echo implode("\n", $foo[1]);
}
$insert1=get_innercode($string);
$insert2=" 2 place me in the pre tag"; // you can ignore this
$string="this is test <pre> WHERE $insert1 SHOULD BE</pre> dont know tell me <pre>WHERE $insert2 SHOULD BE</pre> ok how ";
我怎样才能做到这一点?请注意我不能
$string="some text here <pre> WHERE $insert1 SHOULD BE</pre> some more text here <pre>WHERE $insert2 SHOULD BE</pre> ok how";
因为我从 $string 获取 $insert1 和 $insert2 来修改。我需要把它放回它们来自的地方。谢谢你