日期:2014-05-17  浏览次数:20448 次

正则表达式后向引用
PHP code

$reg = "/(\d{2})\/(\d{2})\/(\d{4})/e";
$text = '01/25/2009到02/02/2009';
$replace = "\${3},\${1}";

echo preg_replace($reg, $replace, $text);




报错:syntax error, unexpected ','
如果将逗号去掉,输出“200901到200902 ”
把逗号换成别的符号也都会报错~

------解决方案--------------------
把e去掉