str_replace() 函数
来源:互联网 发布:python正则表达式替换 编辑:程序博客网 时间:2024/06/07 12:58
PHP String 函数
定义和用法
str_replace() 函数使用一个字符串替换字符串中的另一些字符。
语法
str_replace(find,replace,string,count)
提示和注释
注释:该函数对大小写敏感。请使用 str_ireplace() 执行对大小写不敏感的搜索。
注释:该函数是二进制安全的。
例子
例子 1
<?phpecho str_replace("world","John","Hello world!")
;?>
输出:
Hello John!
例子 2
在本例中,我们将演示带有数组和 count 变量的 str_replace() 函数:
<?php$arr = array("blue","red","green","yellow");print_r(str_replace("red","pink",$arr,$i)
);echo "Replacements: $i";?>
输出:
Array([0] => blue[1] => pink[2] => green[3] => yellow)Replacements: 1
例子 3
<?php$find = array("Hello","world");$replace = array("B");$arr = array("Hello","world","!");print_r(str_replace($find,$replace,$arr)
);?>
输出:
Array([0] => B[1] =>[2] => !)
0 0
- str_replace() 函数
- str_replace() 函数
- str_replace()函数
- PHP函数:str_replace()
- str_replace函数-字符串替换
- PHP str_replace() 函数实例教程
- str_replace函数详解
- str_replace函数详解
- PHP str_replace() 函数
- PHP str_replace() 函数
- PHP str_replace() 函数
- str_replace函数详解
- PHP str_replace() 函数
- PHP中的str_replace函数
- str_replace函数应用
- php的str_replace函数
- 字符串替换函数str_replace
- [str函数] -- str_replace
- Android UI 优化——使用HierarchyViewer工具
- Python学习笔记10:标准库之路径和文件(os.path包,glob包)
- 1006 换个格式输出整数 (15)
- JAVA应用在LINUX环境下中文乱码问题处理
- [Leetcode] Wildcard Matching
- str_replace() 函数
- SpringMvc使用Freemarker时的配置文件
- Spring声明式事务配置管理方法
- 《数据结构》间接寻址类的定义参考部分代码
- JAVA注解在SSH开发中的简单应用
- C# Java间进行RSA加密解密交互 .
- openCV常见错误
- 为什么平衡对游戏数值策划如此重要
- 高手速成android开源项目【View篇】