private function endsWith(string $haystack, string $needle): bool
    {
        $length = \mb_strlen($needle);

        if ($length === 0) {
            return true;
        }

        return \mb_substr($haystack, -$length) === $needle;
    }
private function endsWith(string $haystack, string $needle): bool
    {
        $length = \mb_strlen($needle);

        if ($length === 0) {
            return true;
        }

        return \mb_substr($haystack, -$length) === $needle;
    }
private function endsWith ( string $ haystack , string $ needle ) : bool { $ length = \ mb_strlen ( $ needle ) ; if ( $ length === 0 ) { return true ; } return \ mb_substr ( $ haystack , - $ length ) === $ needle ; }
Determine if a given string ends with a given substring.

@param string $haystack
@param string $needle

@return bool
Determine if a given string ends with a given substring .