![](http://m.sbmmt.com/img/upload/article/000/000/051/5eec698fe4860917.jpg)
php中如何指定位置替换?
使用substr_replace() 函数
定义和用法
substr_replace() 函数把字符串的一部分替换为另一个字符串。
语法substr_replace(string,replacement,start,length)
<?php教程 echo substr_replace("hello world","earth",6); ?>
string 必需。规定要检查的字符串
replacement 必需。规定要插入的字符串。
start 必需。规定在字符串的何处开始替换
可选。规定要替换多少个字符。
推荐教程: 《php教程》
以上就是php中如何指定位置替换的详细内容,更多请关注php中文网其它相关文章!