A short function that checks whether a passed string ends with another passed string, and returns the answer as a boolean value.
1. function EndsWith($FullStr, $EndStr)
2. {
3. // Get the length of the end string
4. $StrLen = strlen($EndStr);
5. // Look at the end of FullStr for the substring the size of
EndStr
6. $FullStrEnd = substr($FullStr, strlen($FullStr) - $StrLen);
7. // If it matches, it does end with EndStr
8. return $FullStrEnd == $EndStr;
9. }