Posted By

archvi on 01/23/12


Tagged

String


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

Priestd09


endswith


 / Published in: PHP
 

Similar to python string.endswith

  1. /**
  2.  * return bool
  3.  ** /
  4. function endswith($char, $string)
  5. {
  6.   return (substr($string, strlen($char) * -1) == $char ) ? true : false;
  7. }

Report this snippet  

Comments

RSS Icon Subscribe to comments
Posted By: keithbluhm on January 26, 2012

return 0 === strpos( strrev( $string ), strrev( $char ) );

You need to login to post a comment.