src/Str.php
public static function endsWith($input, $search, $caseInsensitive = false, $encoding = self::DEFAULT_ENCODING)
    {
        if (($length = static::length($search, $encoding)) == 0) {
            return true;
        }

        $substr = static::sub($input, -$length, $length, $encoding);

        return (static::compare($substr, $search, $caseInsensitive) === 0);
    }
public static function endsWith($input, $search, $caseInsensitive = false, $encoding = self::DEFAULT_ENCODING)
    {
        if (($length = static::length($search, $encoding)) == 0) {
            return true;
        }

        $substr = static::sub($input, -$length, $length, $encoding);

        return (static::compare($substr, $search, $caseInsensitive) === 0);
    }
public static function endsWith ( $ input , $ search , $ caseInsensitive = false , $ encoding = self :: DEFAULT_ENCODING ) { if ( ( $ length = static :: length ( $ search , $ encoding ) ) == 0 ) { return true ; } $ substr = static :: sub ( $ input , - $ length , $ length , $ encoding ) ; return ( static :: compare ( $ substr , $ search , $ caseInsensitive ) === 0 ) ; }
Verifies if a string ends with a substring.

Uses the multibyte function if available with the given encoding $encoding.
The comparison is case-sensitive by default.

@param string $input           The input string to compare to.
@param string $search          The substring to compare the ending to.
@param bool   $caseInsensitive Whether the comparison is case-sensitive.
@param string $encoding        The encoding of the input string.

@return bool Returns true if the $input string ends with the given $search string.
@SuppressWarnings(PHPMD.BooleanArgumentFlag)
Verifies if a string ends with a substring .