November 30, 2017 —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.
The signature of the title
method is:
1public static function title(2 $value3 );
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 Title10echo Str::title('ThIs Is a tItle');
title_case
Helper FunctionThe title_case
helper function is a shortcut to calling Str::title
. This function is declared in the global namespace.
∎
The following amazing people help support this site and my open source projects ♥️
If you're interesting in supporting my work and want to show up on this list, check out my GitHub Sponsors Profile.