最后一句代碼中,$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);
2020-01-08
不能,這是函數的固定格式