From 3ee4fc2d67dc3aecdb72ad39f23fb0ec3637cb08 Mon Sep 17 00:00:00 2001 From: horus Date: Mon, 15 Mar 2021 22:38:27 +0100 Subject: Changes to trailing slash. --- functions.php | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'functions.php') diff --git a/functions.php b/functions.php index 0b7d369..9bd65e4 100644 --- a/functions.php +++ b/functions.php @@ -15,3 +15,11 @@ function str_starts_with( $haystack, $needle ) { $length = strlen( $needle ); return substr( $haystack, 0, $length ) === $needle; } + +function str_ends_with( $haystack, $needle) { + $len = strlen($needle); + if ($len == 0) { + return true; + } + return substr($haystack, -$len) === $needle; +} -- cgit v1.2.3