时间:2021-07-01 10:21:17 帮助过:4人阅读
php替换多个字符串的方法:首先创建一个PHP示例文件;然后通过“tr_replace($vowels, "","Hello World of PHP");”方法替换多个字符串即可。
本文操作环境:windows7系统、PHP5.6版,DELL G3电脑。
str_replace函数
php替换多个字符串
echo str_replace(array("m","i"),array("n","z"),"my name is jim!") echo str_replace(array('m','i'),'n',"my name is jim!"); <?php $vowels = array("a", "e", "i", "o", "u", "A", "E", "I", "O", "U"); $onlyconsonants = str_replace($vowels, "","Hello World of PHP"); echo $onlyconsonants; ?>
推荐:《PHP视频教程》
以上就是php 替换多个字符串的详细内容,更多请关注gxlcms其它相关文章!