From 39c2624d545823cf3b98037212e1f5cc3313b857 Mon Sep 17 00:00:00 2001 From: Arshid Date: Thu, 18 Jan 2024 08:55:56 +0530 Subject: [PATCH] Update Str.php Improve performance --- Str.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Str.php b/Str.php index 87d6eb1c..36051877 100644 --- a/Str.php +++ b/Str.php @@ -85,7 +85,11 @@ public static function of($string) */ public static function after($subject, $search) { - return $search === '' ? $subject : array_reverse(explode($search, $subject, 2))[0]; + if ($search === '') { + return $subject; + } + $pos = strpos($subject, $search); + return $pos === false ? $subject : substr($subject, $pos + strlen($search)); } /**