Posted By

stancell on 04/21/08


Tagged

String ends end


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

dmistriotis


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.