1function endsWith($haystack,$needle,$case=true) {
2 //If its case specific
3 if($case){
4 return (strcmp(substr($haystack, strlen($haystack) - strlen($needle)),$needle)===0);
5 }
6 return (strcasecmp(substr($haystack, strlen($haystack) - strlen($needle)),$needle)===0);
7}