PHP中的替换strtr

 $ar  = array('('=>'',')'=>'','#'=>'','+'=>'-');
  $str = strtr($str,$ar);数组

 

 

strtr ( string $str , string $from , string $to )ide

string strtr ( string $str , array $replace_pairs )

该函数返回 str 的一个副本,并将在 from 中指定的字符转换为 to 中相应的字符。函数

若是 fromto 长度不相等,那么多余的字符部分将被忽略。spa

参数 replace_pairs 能够用来取代 tofrom 参数,由于它是以 array('from' => 'to', ...) 格式出现的数组。ip

相关文章
相关标签/搜索