首页 > php有没有在字符串中插入一个字符串的函数呢?

php有没有在字符串中插入一个字符串的函数呢?

比如在hello的中间加一个a,foo('hello', 'a', 3)这样的


这个貌似没遇到过~不如自己写一个函数通用就好了!


<?php
$str = 'hello';
echo substr_replace($str, 'a', 3, 0); // helalo
?>

没有 自己写一个


用正则试试。。。

【热门文章】
【热门文章】