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;  
?>  

 

posted @ 2018-02-08 15:40  Ryan_zheng  阅读(8440)  评论(0编辑  收藏  举报