We Recommend

Wicked Cool PHP: Real-World Scripts That Solve Difficult Problems Wicked Cool PHP: Real-World Scripts That Solve Difficult Problems
Wicked Cool PHP contains a wide variety of scripts to process credit cards, check the validity of email addresses, template HTML, and serve dynamic images and text.


Posted By

stancell on 04/21/08


Tagged

String ends end


Versions (?)


Check whether string ends with a given string


Published in: PHP 


  1. function string_ends_with($string, $ending)
  2. {
  3. $len = strlen($ending);
  4. $string_end = substr($string, strlen($string) - $len);
  5.  
  6. return $string_end == $ending;
  7. }

Report this snippet 

You need to login to post a comment.