Home  >  Article  >  Backend Development  >  请教这个php程式为什么会出错

请教这个php程式为什么会出错

WBOY
WBOYOriginal
2016-06-13 10:54:26905browse

请问这个php程式为什么会出错。

PHP code
<!--Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->$s2 = "make_by_id";echo convString($s1);function convString($string){    $array = explode('_', $string);    array_walk($array, "ucwords");    return implode('', $array);}


---------------------------------------------
Warning: Wrong parameter count for ucwords() in E:\wwwroot\webtest\test.php on line 25

------解决方案--------------------
PHP code
$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);<br><font color="#e78608">------解决方案--------------------</font><br><br><br>$array = explode('_', $string);<br><br>array_walk($array, "ucwords");<br><br><br>$array前加多个$array=array();<div class="clear">
                 
              
              
        
            </div>
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn