常用正则

1.点连接替换为中括号

$input = 'a.b.c.d.e.f';
$output = preg_replace('/\.(\w+)/', '[$1]', $input);
//输出:a[b][c][d][e][f]

发表评论