In this tutorial you will learn about the Laravel str title() function Example and its application with practical example.
In this article, I’ll show you how to use laravel Str::title method with example. We will show example of laravel Str::title method in laravel. In this tutorial, we will use Str::title method to convert given string to title case.
Laravel Str::title method
The Str::title method converts the given string to Title Case String.
Example:-
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
<?php namespace App\Http\Controllers; use Illuminate\Http\Request; use App\Http\Controllers\FileController; use Illuminate\Support\Str; class HomeController extends Controller { /** * Show the application dashboard. * * @return \Illuminate\Contracts\Support\Renderable */ public function index() { $title = Str::title('this is example title string'); echo $title; } } |
Output:-
1 |
This Is Example Title String |