最后一句代码中,$patten,$replacement,$string三个属性的位置顺序不能换么?
<?php
$str = '主要有以下几个文件:index.php, style.css, common.js';
//将目标字符串$str中的文件名替换后增加em标签
$string = 'April 15,2014';
$patten = '/(\w+)(\d+),(\d+)/i';
$replacement = '$3, ${1}, $2';
echo preg_replace($patten,$replacement,$string);