strtr : 转换某些字符串
string strtr ( string str, string from, string to)
把字符串中的from替换成to 然后返回字符串。
无意中发现strtr函数能把字符串中的字符按照数组中的'key'=>'value'进行替换。
例子:
结果:
hello all, I said hi
string strtr ( string str, string from, string to)
把字符串中的from替换成to 然后返回字符串。
无意中发现strtr函数能把字符串中的字符按照数组中的'key'=>'value'进行替换。
例子:
<?php
    $trans    = array("hello" => "hi", "hi" => "hello");
    echo    strtr("hi all, I said hello", $trans);
?>结果:
hello all, I said hi
 
                     
                    
                 
                    
                 
 
         
                
            
         浙公网安备 33010602011771号
浙公网安备 33010602011771号