function camelcase($str){
return preg_replace_callback('/([-_]+([a-z]{1}))/i',function($matches){
return strtoupper($matches[2]);
},$str);
}
来一个正则表达式版本的
preg_replace('/-([A-Za-z])/e',"strtoupper('$1')",$str)