From 667528d5b927f0f284a067b0e24c9ca7f26c28a4 Mon Sep 17 00:00:00 2001 From: wn_ Date: Sat, 23 Nov 2024 18:23:49 +0000 Subject: Use PHP 8 'str_' functions. A few more characters in some places, but helps with readability. --- include/functions.php | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'include/functions.php') diff --git a/include/functions.php b/include/functions.php index 95d31b248..5e906a977 100644 --- a/include/functions.php +++ b/include/functions.php @@ -279,11 +279,7 @@ } function with_trailing_slash(string $str) : string { - if (substr($str, -1) === "/") { - return $str; - } else { - return "$str/"; - } + return str_ends_with($str, '/') ? $str : "$str/"; } function make_password(int $length = 12): string { -- cgit v1.2.3-54-g00ecf