21,887
社区成员
发帖
与我相关
我的任务
分享
$s = 'a,b,c,d';
echo preg_replace_callback('/(\w)/', function($r) { return "'$r[1]'";}, $s);
"get_post_title".replace(/(^|_)(\w)/g,function($2){
return $2.toUpperCase();
})
//返回这样的结果:Get_Post_Title
不知道为啥$s = 'a,b,c,d';
echo preg_replace_callback('/(?:^|,)([a-z])/', function($r) { return "'$r[1]'";}, $s);
$s = 'get_post_title';
echo preg_replace('/(^|_)(\w)/e', 'strtoupper("$2")', $s);