In this tutorial you will learn about the Laravel str length() function Example and its application with practical example.
Laravel str length() function Example
In this article, I’ll show you how to use laravel str length() function with example. We will show example of str length() function in laravel. In this tutorial, we will use str length() to find the lenght of the provided string.
Laravel Str::length method
The Str::length method determines the length of the given 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 |
<?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() { $length1 = Str::length('laravel'); echo $length1."<br>"; $length2 = Str::length('Hello World!'); echo $length2."<br>"; } } |
Output:-
1 2 |
7 12 |