牛骨文教育服务平台(让学习变的简单)
博文笔记

用php编写一个函数实现 以下功能:字符串hello_world转换成为HelloWorld, get_field_by_id转换成为GetFieldById

创建时间:2016-11-01 投稿人: 浏览次数:193

$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("_");

}

声明:该文观点仅代表作者本人,牛骨文系教育信息发布平台,牛骨文仅提供信息存储空间服务。