public static function replaceFragment($uri, $newFragment = '')
    {
        if ($uri === null) {
            $uri = static::getCurrentRequestUri();
        }
        $oldFragment = parse_url($uri, PHP_URL_FRAGMENT);
        return $oldFragment
            ? str_replace('#' . $oldFragment, '#' . $newFragment, $uri)
            : ($newFragment ? $uri . '#' . $newFragment : $uri);
    }
public static function replaceFragment($uri, $newFragment = '')
    {
        if ($uri === null) {
            $uri = static::getCurrentRequestUri();
        }
        $oldFragment = parse_url($uri, PHP_URL_FRAGMENT);
        return $oldFragment
            ? str_replace('#' . $oldFragment, '#' . $newFragment, $uri)
            : ($newFragment ? $uri . '#' . $newFragment : $uri);
    }
public static function replaceFragment ( $ uri , $ newFragment = '' ) { if ( $ uri === null ) { $ uri = static :: getCurrentRequestUri ( ) ; } $ oldFragment = parse_url ( $ uri , PHP_URL_FRAGMENT ) ; return $ oldFragment ? str_replace ( '#' . $ oldFragment , '#' . $ newFragment , $ uri ) : ( $ newFragment ? $ uri . '#' . $ newFragment : $ uri ) ; }
Replaces fragment part and return updated request part of the URI.

@param string|null $uri
@param string $newFragment
@return string
Replaces fragment part and return updated request part of the URI .