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 = ";
- print_r ( str_replace($t,'str_replace',$str));
- //开源代码phpfensi.com
值str_replacea fdafdafsa fdafda.