Helper function for endsWith
@param string $function
@param string $needle
@return boolean
760838
protected function endsWithDynamic($function, $needle)
    {
        $enc = $this->getEncoding();
        $strlen = $this->length($enc);
        $testlen = mb_strlen($needle, $enc);

        if ($testlen <= $strlen)
        {
            return ($function($this->toString(), $needle, ($strlen-$testlen), $enc)!==false);
        }
        return false;
    }
160644
private function endsWith($haystack, $needle)
    {
        $length = strlen($needle);
        if ($length === 0) {
            return true;
        }

        return substr($haystack, -$length) === $needle;
    }
972871
protected function textEndsWith($string, $ends_with)
    {
        $ends_with = trim($ends_with);
        if ($ends_with === '') {
            return false;
        }

        return substr_compare($string, $ends_with, -strlen($ends_with), strlen($ends_with)) === 0;
    }
478105
public function doesStringEndWith(string $string, string $test): bool {
		$strlen = strlen($string);
		$testlen = strlen($test);
		if ($testlen > $strlen) {
			return false;
		}
		return substr_compare($string, $test, $strlen - $testlen, $testlen) === 0;
	}
913952
public static function endsWith(
        string $haystack,
        string $needle,
        $caseSensitive = true
    ) : bool {
        $needleLength = strlen($needle);
        $cmp = substr_compare(
            $haystack,
            $needle,
            -($needleLength),
            $needleLength,
            !$caseSensitive
        );

        return $cmp === 0;
    }
615551
function endsWith(str, prefix) {
  return (str.indexOf(prefix, str.length - prefix.length) !== -1);
}
905528
public static function ends($haystack, $needle, $caseSensitive = false): bool
    {
        if ($caseSensitive === true) {
            return $needle === '' || mb_substr($haystack, -mb_strlen($needle)) === $needle;
        }
        $haystack = mb_strtolower($haystack);
        $needle = mb_strtolower($needle);

        return $needle === '' || mb_substr($haystack, -mb_strlen($needle)) === $needle;
    }
1233675
public function endWith($needle) {
        if (!$this->_isValid) {
            return $this;
        }
        $rPos = mb_strrpos($this->_unsafeVar, $needle, null, $this->conf['encoding']);
        if ($rPos === false) {
            $this->_isValid = false;
        } else {
            $varLength = mb_strlen($this->_unsafeVar, $this->conf['encoding']);
            $needleLength = mb_strlen($needle, $this->conf['encoding']);
            if ($varLength != $rPos + $needleLength) {
                $this->_isValid = false;
            }
        }
        return $this;
    }
205645
public static function lastIndexOf($string, $needle, $strict = true, $offset = 0) {
        if ($strict) {
            return mb_strrpos($string, $needle, $offset);
        }

        return mb_strripos($string, $needle, $offset);
    }
949535
function endsWithAny(string, vector) {
  return _.any(vector.map(function (e) { return _str.endsWith(string, e); }));
}
921747
static function endsWith($string, $endsWith, $caseSensitive = true) {
		$len = self::strlen($endsWith);
		if ($caseSensitive) return self::substr($string, -1 * $len) == $endsWith;
		return self::strtolower(self::substr($string, -1 * $len)) == self::strtolower($endsWith);
	}
511142
function endsWith(longStr, shortStr) {
		var longLen = longStr.length, shortLen = shortStr.length;
		return (longLen >= shortLen) &&
			(longStr.substr(longLen - shortLen) === shortStr);
	}
1270845
function endsWith(str, ending) {
        if (str.length - ending.length === str.lastIndexOf(ending))
            return true;
        else return false;
    }
1051468
static public function endWith($haystack, $needle)
    {
        if (substr($haystack, -strlen($needle)) === (string) $needle) {
            return true;
        }

        return false;
    }
305139
public function lastIndexOf($needle)
    {
        $res = null;
        foreach ($this as $k => $v) {
            if ($v === $needle) {
                $res = $k;
            }
        }
        return $res;
    }
1293537
public function endswith(string $haystack, string $needle) : bool
    {
        return (substr($haystack, -1 * strlen($needle)) === $needle);
    }
154691
function endsWithString(endingValue, valueToTest) {
  const position = valueToTest.length - endingValue.length;
  const lastIndexOfValue = valueToTest.lastIndexOf(endingValue);

  return !!~lastIndexOfValue && lastIndexOfValue === position;
}