public function endsWith($string, $search, $position = null)
    {
        $string = (string)$string;

        $position = $position !== null ? $position : mb_strlen($string, 'UTF-8');
        $position = $position - mb_strlen($search, 'UTF-8');
        return mb_strrpos($string, $search, null, 'UTF-8') === $position;
    }
public function endsWith($string, $search, $position = null)
    {
        $string = (string)$string;

        $position = $position !== null ? $position : mb_strlen($string, 'UTF-8');
        $position = $position - mb_strlen($search, 'UTF-8');
        return mb_strrpos($string, $search, null, 'UTF-8') === $position;
    }
public function endsWith ( $ string , $ search , $ position = null ) { $ string = ( string ) $ string ; $ position = $ position !== null ? $ position : mb_strlen ( $ string , 'UTF-8' ) ; $ position = $ position - mb_strlen ( $ search , 'UTF-8' ) ; return mb_strrpos ( $ string , $ search , null , 'UTF-8' ) === $ position ; }
Test if a string ends with the given search string

Example::

String.endsWith('Hello, World!', 'World!') == true

@param string $string The string
@param string $search A string to search
@param integer $position Optional position for limiting the string
@return boolean true if the string ends with the given search
Test if a string ends with the given search string