1、字符串替换多个关键字
1 $pattern = array('/a/', '/a/', '/a/'); 2 $replacement = array('x', 'y', 'z'); 3 $subject = 'abcadeafg'; 4 $res = preg_replace($pattern, $replacement, $subject , 1); 5 echo $res; // xbcydezfg
posted on 2016-05-25 15:46 royhoo 阅读(169) 评论(0) 编辑 收藏 举报