diff options
| author | horus | 2021-03-15 22:38:27 +0100 |
|---|---|---|
| committer | horus | 2021-03-15 22:38:27 +0100 |
| commit | 3ee4fc2d67dc3aecdb72ad39f23fb0ec3637cb08 (patch) | |
| tree | 257476f6b031a7bf88a06a6690b8fecc5a6081ac /functions.php | |
| parent | 83fec0b53ae04e23948b981cf845ce0d476ba22a (diff) | |
| download | moehring-3ee4fc2d67dc3aecdb72ad39f23fb0ec3637cb08.tar.gz | |
Changes to trailing slash.
Diffstat (limited to 'functions.php')
| -rw-r--r-- | functions.php | 8 |
1 files changed, 8 insertions, 0 deletions
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; +} |
