Laravel 5.5 String Helper Function: after

Making Sure Strings Start With a Given Value in Laravel - Laravel 5.5 String Helper Method. start

The after method can be used to return a part of a string after the first occurrence of a $search character.

This method can be used to help parse URL query strings, or to quickly find substrings based on a certain character.


The signature of the after method is:

1public static function after(
2 $subject,
3 $search
4 );

Example Use

The after method can be used like so:

1use Illuminate\Support\Str;
3// Outputs "ref=newsletter"
4echo Str::after('', '?');

Recent articles


Covering topics from JavaScript to Laravel, and everything in-between since 2012.


© Stillat, LLC. All right reserved.
Code highlighting provided by Torchlight