yii\helpers\BaseStringHelper::endsWith PHP Method

endsWith() public static method

Binary and multibyte safe.
public static endsWith ( string $string, string $with, boolean $caseSensitive = true ) : boolean
$string string Input string to check
$with string Part to search inside of the $string.
$caseSensitive boolean Case sensitive search. Default is true. When case sensitive is enabled, $with must exactly match the ending of the string in order to get a true value.
return boolean Returns true if first input ends with second input, false otherwise
    public static function endsWith($string, $with, $caseSensitive = true)
    {
        if (!($bytes = static::byteLength($with))) {
            return true;
        }
        if ($caseSensitive) {
            // Warning check, see http://php.net/manual/en/function.substr-compare.php#refsect1-function.substr-compare-returnvalues
            if (static::byteLength($string) < $bytes) {
                return false;
            }
            return substr_compare($string, $with, -$bytes, $bytes) === 0;
        } else {
            return mb_strtolower(mb_substr($string, -$bytes, mb_strlen($string, '8bit'), '8bit'), Yii::$app->charset) === mb_strtolower($with, Yii::$app->charset);
        }
    }