how can we check a string containing a specific word in Laravel, Laravel provides a lot of features one of the best features is to find some words from a string or article. Laravel provides us with a method Str which we use to find a specific word and more than one word.
In this article, we will see how to use the str method to find a specific word and more than one word. Here is the example step-by-step.
Example: find a word
use Illuminate\Support\Str; $finder = Str::contains('Welcome to theskillstock', 'theskillstock');
Example: Find multiple words
Str::contains($string, [$finding_word, $finding_word2]);
use Illuminate\Support\Str; $finder = Str::contains('Hello! Welcome to theskillstock', ['Hello!', 'theskillstock']);
Thank you for reading this article. I hope it is helpful to you.
Hello World! https://apel.top/go/gu4winrshe5dgoju?hs=4c59f48fd4e15e65b37ac50b23b72f3c& Mar 24th 2023