Laravel str is() function Example

10-Apr-2023

.

Admin

Hi Guys,

In this blog,I will you how to use laravel str is() function example. We will show example of is function in laravel.The Str::is method to string matches a given pattern.

Here, The Str::is method determines if a given string matches a given pattern. Asterisks may be used to indicate wildcards

Example


<?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()

{

$is1 = Str::is('nices*', 'nicesnippets');

dd($is1);

// output - true

$is2 = Str::is('itlogin*', 'itsolutionstuff');

dd($is2);

// output - false

}

}

Output

true

false

It Will help you...

#Laravel 8

#Laravel 7

#Laravel

#Laravel 6