这个为什么要加括号
$string = 'April 15, 2014'; $pattern = '/(\w+) (\d+), (\d+)/i'; $replacement = '$3, ${1} $2'; echo preg_replace($pattern, $replacement, $string); //结果为:2014, April 15
为什么要加括号,表示3个子组吗?
$string = 'April 15, 2014'; $pattern = '/(\w+) (\d+), (\d+)/i'; $replacement = '$3, ${1} $2'; echo preg_replace($pattern, $replacement, $string); //结果为:2014, April 15
为什么要加括号,表示3个子组吗?
2018-12-12
举报