PHP and javascript snippets you can copy and paste.

Showing posts with label php string str_get_strMatchesEnd. Show all posts
Showing posts with label php string str_get_strMatchesEnd. Show all posts

Thursday, March 15, 2007

str_get_strMatchesEnd($needle,$haystack)

/**
* str_get_strMatchesEnd
*
* Returns true if $needle matches the end of $haystack.
* @param $needle.
* @param $haystack
* @return bool.
*/

function str_get_strMatchesEnd($needle,$haystack){
return strrev(substr(strrev($haystack),0,strlen($needle)))==$needle;
}