diff options
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; +} |
