strtr() 函数转换字符串中特定的字符.
语法:strtr(string,from,to)或者strtr(string,array)
- */
- $addr=strtr($addr,"","aao");
- $trans=array("hello"=>"hi","hi"=>"hello");
- echo strtr("hi all, i said hello",$trans);
-
- echo strtr("hilla warld","ia","eo");
-
- $arr = array("hello" => "hi", "world" => "earth");
- echo strtr("hello world",$arr);
- /*
- 如果 from 和 to 的长度不同,则格式化为最短的长度.
|