public function endsWith(string $haystack, string $needle): bool
    {
        $escaped = preg_quote($needle);

        return (bool) preg_match("/$escaped$/", $haystack);
    }
public function endsWith(string $haystack, string $needle): bool
    {
        $escaped = preg_quote($needle);

        return (bool) preg_match("/$escaped$/", $haystack);
    }
public function endsWith ( string $ haystack , string $ needle ) : bool { $ escaped = preg_quote ( $ needle ) ; return ( bool ) preg_match ( "/$escaped$/" , $ haystack ) ; }
Checks if a string ends with another one.

@param string $haystack The string to search in
@param string $needle   The string to search for

@return bool
Checks if a string ends with another one .