php教程 自定字符串中的部分字符进行替换方法
substr_replace()函数对自定字符串中的部分字符进行替换
语法:substr_replace(str,repl,start,[int length])
语法说明:
str——必选参数,指定要操作的原始字符串
repl——指定替换后的新字符串
start——指定替换字符串的开始位置
length——可选参数,指定返回字符串的长度。
使用substr_replace()函数替换字符串的应用实例:
实例代码:
$b=”手册”;
$c=”zero的php博客”;
echo substr_replace($c,$b,9,4);
?>
输出结果:
zero的php手册
参数 | 描述 |
---|---|
string | 必需。规定要检查的字符串。 |
replacement | 必需。规定要插入的字符串。 |
start |
必需。规定在字符串的何处开始替换。
|
charlist |
可选。规定要替换多少个字符。
|

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Dreamweaver Mac version
Visual web development tools

EditPlus Chinese cracked version
Small size, syntax highlighting, does not support code prompt function

Notepad++7.3.1
Easy-to-use and free code editor

Atom editor mac version download
The most popular open source editor

ZendStudio 13.5.1 Mac
Powerful PHP integrated development environment
