php中 strtr 和 str_replace区别

两者都是替换字符串中某个值
例如:

 $a = strtr('hello', ['he' => 'n999']);
 $b = str_replace('he', 'n999', 'hello');
 d($b);

测试结果:$a = $b

猜你喜欢

转载自blog.csdn.net/weixin_42433970/article/details/114122758