part of url php
snippet in php

parse url php

user6733

var_dump(parse_url($url)); 
var_dump(parse_url($url, PHP_URL_SCHEME)); 
var_dump(parse_url($url, PHP_URL_QUERY)); 

part of url php

user465

    //https://www.google.com/search?key=1234
	$url = $_SERVER['REQUEST_URI']; 
    $url_components = parse_url($url); 
    parse_str($url_components['query'], $params); 
    $key = $params['key']; 

// key=1234