php-替换字符串 可刷新运行 刷新

一些比较方便的替换字符串操作

代码:

echo strstr("I love Shanghai!","Shangh",true);
echo "<br>";
echo strstr("I love Shanghai!","Shangh");


echo "<br>";
echo strtr("Hilla Warld","ia","eo");
echo "<br>";
$arr = array("Hello" => "Hi", "world" => "earth");
echo strtr("Hello world",$arr);

输出:

I love
Shanghai!
Hello World
Hi earth