How to Get Part of a String after Another String or Character in Laravel
In this lesson, we are going to see how to get part of a string after another string or character in Laravel, the after helper method is used to return part of a string after the first occurrence of a given string.
The Str::after helper method
The after() method is used to return a section of a string after the first occurrence of a specific string.
use Illuminate\Support\Str;
$website = 'http://www.website.com?id=1';
$param = Str::after($website, '?');
echo $param;
// Returns "id=1"