str_replace 数组,条件是替换与被替换数组长度必须相等,代码如下:
$t = array ( '<' , '>' ); $e = array ( '<' , '>' ); print_r ( str_replace ( $t , 'ddd' , $t )); /* ( [0] => ddd [1] => ddd ) */ print_r( str_replace ( $t , $e , $t ) ); /* Array ( [0] => < [1] => > ) */再测试字符串与数组,代码如下:
$t = array ( '<' , '>' ); $e = array ( '<' , '>' ); $str = "<a fdafdafsa fdafda" ; print_r ( str_replace ( $t , 'str_replace' , $str )); //开源代码phpfensi测试数据值str_replacea fdafdafsa fdafda.
查看更多关于str_replace 数组替换应用例子的详细内容...
声明:本文来自网络,不代表【好得很程序员自学网】立场,转载请注明出处:http://haodehen.cn/did31381