src/Url.php
public static function setUrlParams($url = false)
    {
        $url = $url !== false ? $url : self::getCurrentPage();

        if (strpos($url, '?') == false && strpos($url, '&') != false) {
            $url = preg_replace('/&/', '?', $url, 1);
            $parts = parse_url($url);
            $query = isset($parts['query']) ? $parts['query'] : '';

            parse_str($query, $query);
        }

        foreach (isset($query) ? $query : [] as $key => $value) {
            $_GET[$key] = $value;
        }

        return explode('?', $url)[0];
    }
public static function setUrlParams($url = false)
    {
        $url = $url !== false ? $url : self::getCurrentPage();

        if (strpos($url, '?') == false && strpos($url, '&') != false) {
            $url = preg_replace('/&/', '?', $url, 1);
            $parts = parse_url($url);
            $query = isset($parts['query']) ? $parts['query'] : '';

            parse_str($query, $query);
        }

        foreach (isset($query) ? $query : [] as $key => $value) {
            $_GET[$key] = $value;
        }

        return explode('?', $url)[0];
    }
Set parameters from the URL and return URL without them.

If a URL is received as: http://www.web.com/&key=value&key-2=value
params will be saved as GET values and return: http://www.web.com/

If a URL is received as: http://www.web.com/?key=value&key-2=value
GET parameters are maintained and return: http://www.web.com/

@since 1.1.5

@param string $url → URL

@return string → URL