diff --git a/src/Illuminate/Support/Str.php b/src/Illuminate/Support/Str.php index 46d15353882f..260b25a8ef6b 100644 --- a/src/Illuminate/Support/Str.php +++ b/src/Illuminate/Support/Str.php @@ -187,7 +187,7 @@ public static function contains($haystack, $needles, $ignoreCase = false) } foreach ((array) $needles as $needle) { - if ($needle !== '' && mb_strpos($haystack, $needle) !== false) { + if ($needle !== '' && str_contains($haystack, $needle)) { return true; } } @@ -231,7 +231,7 @@ public static function endsWith($haystack, $needles) foreach ((array) $needles as $needle) { if ( $needle !== '' && $needle !== null - && substr($haystack, -strlen($needle)) === (string) $needle + && str_ends_with($haystack, $needle) ) { return true; } @@ -763,7 +763,7 @@ public static function snake($value, $delimiter = '_') public static function startsWith($haystack, $needles) { foreach ((array) $needles as $needle) { - if ((string) $needle !== '' && strncmp($haystack, $needle, strlen($needle)) === 0) { + if ((string) $needle !== '' && str_starts_with($haystack, $needle)) { return true; } }