php替换多个字符的方法:首先创建一个PHP示例文件;然后通过“str_replace($vowels, "","Hello World of PHP");”方法替换多个字符串即可。
推荐:《PHP视频教程》
php替换多个字符串str_replace函数
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; ?>
Atas ialah kandungan terperinci php 如何替换多个字符. Untuk maklumat lanjut, sila ikut artikel berkaitan lain di laman web China PHP!