PHP string variable hump Method

? <PHP 

// Title requirements: Input format is "get-element-by-id " is an arbitrary character string, converts it to a string camelCasing, e.g. the getElementById /
// example: $ str = "get-element- by-ID ";

$ STR =" GET-Element-by-ID ";
$ ARR = the explode ( '-', $ STR);
for ($ I =. 1; $ I <COUNT ($ ARR); $ I ++) {
$ ARR [$ I] = ucfirst ($ ARR [$ I]);
}
$ = STR The implode ( '', $ ARR);
echo $ STR;

?>

Guess you like

Origin www.cnblogs.com/wjlbk/p/11785428.html