Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

How To Check If A String Ends With Another String In PHP

function endsWith($haystack,$needle,$case=true) {
    //If its case specific
    if($case){
      return (strcmp(substr($haystack, strlen($haystack) - strlen($needle)),$needle)===0);
    }
    return (strcasecmp(substr($haystack, strlen($haystack) - strlen($needle)),$needle)===0);
}
Source by www.tutsplanet.com #
 
PREVIOUS NEXT
Tagged: #How #To #Check #If #A #String #Ends #With #Another #String #In #PHP
ADD COMMENT
Topic
Name
6+4 =