用php编写一个函数实现 以下功能:字符串hello_world转换成为HelloWorld, get_field_by_id转换成为GetFieldById
$string = "Hello_world";
$string1="get_field_by_id";
echo GaiBian($string);
echo GaiBian($string1)
function GaiBian($string){
$token =strtok($string, "_");//分割字符串
while ($token != false)
{
$token=ucfirst($token);//给首字母大写
echo "$token";
$token = strtok("_");
}
}
声明:该文观点仅代表作者本人,牛骨文系教育信息发布平台,牛骨文仅提供信息存储空间服务。