日期:2014-05-17 浏览次数:20356 次
$s2 = "make_by_id"; echo convString($s1); function convString($string) { $array = explode('_', $string); array_walk($array, "ucwords"); return implode('', $array); }
$arr2 = explode('_', $s2); function self_ucwords(&$p_a, $p_b)//通常传入2参数,也可以3个参数,更详细用法查手册 { $p_a = ucwords($p_a);//一个参数 } array_walk($arr2, 'self_ucwords'); echo implode('', $arr2);
------解决方案--------------------
$array = explode('_', $string);
array_walk($array, "ucwords");
$array前加多个$array=array();