How to Check If a String Starts with Another String in Laravel 9
In this lesson, we are going to see how to check If a string starts with another string in Laravel 9, the startsWith helper method is used to check if a string starts with a specific word.
The Str::startsWith helper method
The startsWith() method checks if the provided string starts with a specific word if yes it returns true otherwise it returns false.
use Illuminate\Support\Str;
Str::startsWith('Darija coding', 'Darija');
// true