我有这样的文字
"Hello, Hello, how are you?
Hello, Hello, how are you?<br />
Hello,
Hello,<br />
How are you?
How are you today?
I am fine; I am great
I am fine;<br />
I am just great
I am fine; I am great
I'm very well today!<br />
Great!
Hello, Hello, how are you?<br />
Hello, Hello, how are you?
Hello, Hello, How are you?<br />
How are you today?"
我需要将第四号替换<br />为<img>
如果只<br/>找到一个,则替换第一个
就一次
我尝试使用
function str_replace_first($from, $to, $subject)
{
$from = '/'.preg_quote($from, '/').'/';
return preg_replace($from, $to, $subject, 1);
}
但它只替换了找到的第一个
我尝试更换4号
千万里不及你