Skip to content

Commit

Permalink
Build less temporary strings
Browse files Browse the repository at this point in the history
  • Loading branch information
staabm committed Oct 29, 2024
1 parent dc7b864 commit 75a03d4
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions src/StringUtil.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

0 comments on commit 75a03d4

Please sign in to comment.