9.3.5 字符串的替换(str_replace)

9.3.5 字符串的替换(str_replace)

1.php

";
    echo $newstr."
"; echo "替换的次数为:{$num}
";

2.php

3.php

";
    echo $newstr."
"; echo "替换的次数为:{$num}
"; */ $num = 0; //正常 峰哥 妹子 $str="这是一句正常的峰哥句子,妹子但里面有一些不能显示的文字"; $newstr = str_replace(array("正常", "妹子", "峰哥"), "**", $str, $num); echo $str."
"; echo $newstr."
"; echo "替换的次数为:{$num}
";

test.php

";
    echo $newstr."
"; echo "替换的次数为:{$num}
"; */ $num = 0; //正常 峰哥 妹子 $str="这是一句正常的峰哥句子,妹子但里面有一些不能显示的文字"; $newstr = str_replace(array("正常", "妹子", "峰哥"), array("很正常", "漂亮", "帅哥"), $str, $num); echo $str."
"; echo $newstr."
"; echo "替换的次数为:{$num}
";

你可能感兴趣的:(9.3.5 字符串的替换(str_replace))