Ask why this php program has an error

Source: Internet
Author: User
Why is this php program wrong. PHPcode $ s2 & quot; make_by_id & quot; echoconvString ($ s1); functionconvString ($ string) {$ arrayexplode (_, $ string); array_walk ($ array, & quot; ucwords & quo: Why is this php program wrong.
PHP code
  $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

------ Solution --------------------
PHP code
$ Arr2 = explode ('_', $ s2); function self_ucwords (& $ p_a, $ p_ B) // you can specify two or three parameters, for more details, see the manual {$ p_a = ucwords ($ p_a); // A parameter} array_walk ($ arr2, 'Self _ ucword'); echo implode ('', $ arr2 );
------ Solution --------------------


$ Array = explode ('_', $ string );

Array_walk ($ array, "ucwords ");


$ Add multiple $ array = array () before array ();

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.