return (substr($string, 0, $len) === $startString);
 }
 
+// ttEndsWith functions checks if a string ends with a given substring.
+function ttEndsWith($string, $endString)
+{
+    $len = strlen($endString);
+    if ($len == 0) return true;
+    return (substr($string, -$len) === $endString);
+}
+
 // ttDateToUserFormat converts a date from database format to user format.
 function ttDateToUserFormat($date)
 {