By John Koster
This method will convert the given $value
to look like a traditional print title. This method essentially will transform the entire $value
to its lower cased equivalent and then uppercase the first character of each word it finds. This method may potentially affect the case of every character in the string.
#Signature
The signature of the title
method is:
1public static function title(
2 $value
3 );
#Example Use
1use Illuminate\Support\Str;
2
3// This Is A Title
4echo Str::title('THIS IS A TITLE');
5
6// This Is A Title
7echo Str::title('this is a title');
8
9// This Is A Title
10echo Str::title('ThIs Is a tItle');
#Global title_case
Helper Function
The title_case
helper function is a shortcut to calling Str::title
. This function is declared in the global namespace.
∎