public static function endsWith($string, $with, $caseSensitive = true, $encoding = null)
    {
        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;
        }
        if (!isset($encoding)) {
            $encoding = \Reaction::$app ? \Reaction::$app->charset : 'UTF-8';
        }
        return mb_strtolower(mb_substr($string, -$bytes, mb_strlen($string, '8bit'), '8bit'), $encoding) === mb_strtolower($with, $encoding);
    }
public static function endsWith($string, $with, $caseSensitive = true, $encoding = null)
    {
        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;
        }
        if (!isset($encoding)) {
            $encoding = \Reaction::$app ? \Reaction::$app->charset : 'UTF-8';
        }
        return mb_strtolower(mb_substr($string, -$bytes, mb_strlen($string, '8bit'), '8bit'), $encoding) === mb_strtolower($with, $encoding);
    }
public static function endsWith ( $ string , $ with , $ caseSensitive = true , $ encoding = null ) { 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 ; } if ( ! isset ( $ encoding ) ) { $ encoding = \ Reaction :: $ app ? \ Reaction :: $ app -> charset : 'UTF-8' ; } return mb_strtolower ( mb_substr ( $ string , - $ bytes , mb_strlen ( $ string , '8bit' ) , '8bit' ) , $ encoding ) === mb_strtolower ( $ with , $ encoding ) ; }
Check if given string ends with specified substring.
Binary and multibyte safe.

@param string $string Input string to check
@param string $with Part to search inside of the $string.
@param bool $caseSensitive 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.
@param string $encoding String encoding
@return bool Returns true if first input ends with second input, false otherwise
Check if given string ends with specified substring . Binary and multibyte safe .