发布网友 发布时间:2022-04-06 01:08
共3个回答
热心网友 时间:2022-04-06 02:37
如果数字不确定,可以用正则替换
$str = "(123,123,123,";
$str = preg_replace('/(\d+),(\d+),(\d+),/', '${1},${2},${3})', $str);
echo $str;
或者
$str = "(123,123,123,";
$str = preg_replace('/\(([\d,]+),/', '(${1})', $str);
echo $str;
热心网友 时间:2022-04-06 03:55
$string = "(123,123,123,";
$pattern = "/(\d+\,\d+\,\d+),/";
$replacement = "$1)";
$string = preg_replace($pattern, $replacement, $string);
热心网友 时间:2022-04-06 05:30
如果数字不确定,可以用正则替换
$str
=
"(123,123,123,";
$str
=
preg_replace('/(\d+),(\d+),(\d+),/',
'${1},${2},${3})',
$str);
echo
$str;
或者
$str
=
"(123,123,123,";
$str
=
preg_replace('/\(([\d,]+),/',
'(${1})',
$str);
echo
$str;