Supported Versions: PHP 4, PHP 5, PHP 7, PHP 8
Parse a URL and return its components
parse_url(string $urlint $component = -1): int|string|array|null|false
    protected function replaceBaseUrl($uri$url)

    {

        
$parsed parse_url($url);



        return 
$uri

            
->withScheme($parsed['scheme'])
    {

        
$uri $app->make('config')->get('app.url''http://localhost');



        
$components parse_url($uri);



        
$server $_SERVER;
$publicPath getcwd();



$uri urldecode(

    
parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH) ?? ''

);
    protected function allSubdomainsOfApplicationUrl()

    {

        if (
$host parse_url($this->app['config']->get('app.url'), PHP_URL_HOST)) {

            return 
'^(.+\.)?'.preg_quote($host).'$';

        }

    }
        if (! is_null($fragment parse_url($uriPHP_URL_FRAGMENT))) {

            
$uri preg_replace('/#.*/'''$uri);

        }
    {

        
$url preg_replace('#^(sqlite3?):///#''$1://null/'$url);



        
$parsedUrl parse_url($url);



        if (
$parsedUrl === false) {

            throw new 
InvalidArgumentException('The database configuration URL is malformed.');
            return false;

        }



        if (
$url parse_url($valuePHP_URL_HOST)) {

            try {

                return 
count(dns_get_record($url.'.'DNS_A DNS_AAAA)) > 0;

            } catch (
Exception $e) {
        $response = new RedirectResponse('foo.bar');



        
$response->withFragment('foo');

        
$this->assertSame('foo'parse_url($response->getTargetUrl(), PHP_URL_FRAGMENT));



        
$response->withFragment('#bar');

        
$this->assertSame('bar'parse_url($response->getTargetUrl(), PHP_URL_FRAGMENT));
        $this->assertSame('foo'parse_url($response->getTargetUrl(), PHP_URL_FRAGMENT));



        
$response->withFragment('#bar');

        
$this->assertSame('bar'parse_url($response->getTargetUrl(), PHP_URL_FRAGMENT));



        
$response->withoutFragment();

        
$this->assertNull(parse_url($response->getTargetUrl(), PHP_URL_FRAGMENT));
        $this->assertSame('bar'parse_url($response->getTargetUrl(), PHP_URL_FRAGMENT));



        
$response->withoutFragment();

        
$this->assertNull(parse_url($response->getTargetUrl(), PHP_URL_FRAGMENT));

    }



    public function 
testInputOnRedirect()