在指定位置插入字符串 [英] Insert string at specified position

查看:75
本文介绍了在指定位置插入字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有可以做到这一点的PHP函数?

Is there a PHP function that can do that?

我正在使用strpos获取子字符串的位置,我想在该位置之后插入string.

I'm using strpos to get the position of a substring and I want to insert a string after that position.

推荐答案

$newstr = substr_replace($oldstr, $str_to_insert, $pos, 0);

http://php.net/substr_replace

这篇关于在指定位置插入字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆