In this tutorial we wiill see how to use laravel str is() function example. We will see example of is function in laravel. The Str::is method determines if a given string matches a given pattern. 

Asterisks may be used to indicate wildcards

Given below is the example on how to use laravael str is() function.



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



I hope this example helps you.