From 75a03d4aae7f3aedb2e101ca7baa108f4e4b21c2 Mon Sep 17 00:00:00 2001 From: Markus Staab Date: Tue, 29 Oct 2024 20:10:50 +0100 Subject: [PATCH] Build less temporary strings --- src/StringUtil.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/StringUtil.php b/src/StringUtil.php index 4fa1613..b78b200 100644 --- a/src/StringUtil.php +++ b/src/StringUtil.php @@ -46,10 +46,8 @@ private static function findCommonPrefix(string $string1, string $string2): stri if (!isset($string2[$i]) || $string1[$i] != $string2[$i]) { break; } - - $prefix .= $string1[$i]; } - return $prefix; + return substr($string1, 0, $i); } }