src/HTTP.php
public static function parsedURLToString($parsed_url) {

		$components = [];

		if(!empty($parsed_url['scheme'])){

			$components['scheme'] = $parsed_url['scheme'] . '://';
		}

		$components['user'] = '';
		$components['pass'] = '';

		if(!empty($parsed_url['user'])){

			$components['user'] = $parsed_url['user'];
		}

		if(!empty($parsed_url['pass'])){

			$components['pass'] = ':' . $parsed_url['pass'];
		}

		if($components['user'] || $components['pass']){

			$components['pass'] = $components['pass'] . '@';
		}

		if(!empty($parsed_url['host'])){

			$components['host'] = $parsed_url['host'];
		}

		if(!empty($parsed_url['port'])){

			$components['port'] = ':' . $parsed_url['port'];
		}

		if(!empty($parsed_url['path'])){

			$components['path'] = $parsed_url['path'];
		}

		if(!empty($parsed_url['query'])){

			$components['query'] = '?' . $parsed_url['query'];
		}

		if(!empty($parsed_url['fragment'])){

			$components['fragment'] = '#' . $parsed_url['fragment'];
		}

		return implode('', $components);
	}
public static function parsedURLToString($parsed_url) {

		$components = [];

		if(!empty($parsed_url['scheme'])){

			$components['scheme'] = $parsed_url['scheme'] . '://';
		}

		$components['user'] = '';
		$components['pass'] = '';

		if(!empty($parsed_url['user'])){

			$components['user'] = $parsed_url['user'];
		}

		if(!empty($parsed_url['pass'])){

			$components['pass'] = ':' . $parsed_url['pass'];
		}

		if($components['user'] || $components['pass']){

			$components['pass'] = $components['pass'] . '@';
		}

		if(!empty($parsed_url['host'])){

			$components['host'] = $parsed_url['host'];
		}

		if(!empty($parsed_url['port'])){

			$components['port'] = ':' . $parsed_url['port'];
		}

		if(!empty($parsed_url['path'])){

			$components['path'] = $parsed_url['path'];
		}

		if(!empty($parsed_url['query'])){

			$components['query'] = '?' . $parsed_url['query'];
		}

		if(!empty($parsed_url['fragment'])){

			$components['fragment'] = '#' . $parsed_url['fragment'];
		}

		return implode('', $components);
	}
public static function parsedURLToString ( $ parsed_url ) { $ components = [ ] ; if ( ! empty ( $ parsed_url [ 'scheme' ] ) ) { $ components [ 'scheme' ] = $ parsed_url [ 'scheme' ] . '://' ; } $ components [ 'user' ] = '' ; $ components [ 'pass' ] = '' ; if ( ! empty ( $ parsed_url [ 'user' ] ) ) { $ components [ 'user' ] = $ parsed_url [ 'user' ] ; } if ( ! empty ( $ parsed_url [ 'pass' ] ) ) { $ components [ 'pass' ] = ':' . $ parsed_url [ 'pass' ] ; } if ( $ components [ 'user' ] || $ components [ 'pass' ] ) { $ components [ 'pass' ] = $ components [ 'pass' ] . '@' ; } if ( ! empty ( $ parsed_url [ 'host' ] ) ) { $ components [ 'host' ] = $ parsed_url [ 'host' ] ; } if ( ! empty ( $ parsed_url [ 'port' ] ) ) { $ components [ 'port' ] = ':' . $ parsed_url [ 'port' ] ; } if ( ! empty ( $ parsed_url [ 'path' ] ) ) { $ components [ 'path' ] = $ parsed_url [ 'path' ] ; } if ( ! empty ( $ parsed_url [ 'query' ] ) ) { $ components [ 'query' ] = '?' . $ parsed_url [ 'query' ] ; } if ( ! empty ( $ parsed_url [ 'fragment' ] ) ) { $ components [ 'fragment' ] = '#' . $ parsed_url [ 'fragment' ] ; } return implode ( '' , $ components ) ; }
Convert a parsed URL back to a string.

<p>Basically the opposite of parse_url. Specify a set of components
and this function turns it back into a string again.</p>

@see parse_url()
@param array $parsed_url
@return string
Convert a parsed URL back to a string .