Published on November 27, 2017
Camel casing is similar to studly case such that each word starts with a capitalized letter, with the difference being the first character is lower cased. Like the
studly method, the
camel method will not affect the casing of the rest of the word.
The signature of the
camel method is:
1public static function camel(2 $value3 );
The following examples will all return the string
1use Illuminate\Support\Str;23// myWords4echo Str::camel('my words');56// myWords7echo Str::camel('my-words');89// myWords10echo Str::camel('my_words');1112// myWords13echo Str::camel(' my-words_');
camel function does not affect the casing of any characters after the first one.
1use Illuminate\Support\Str;23// mYWORDS4echo Str::camel('MY WORDS');56// mywords7echo Str::camel('mywords');
camel_case function is a shortcut to calling
Str::camel. This function is declared in the global namespace.
Published on April 22, 2018
Published on April 11, 2018