Skip to content

Instantly share code, notes, and snippets.

@yokesharun
Created February 9, 2016 06:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yokesharun/af58ca9feab2fe947559 to your computer and use it in GitHub Desktop.
Save yokesharun/af58ca9feab2fe947559 to your computer and use it in GitHub Desktop.
PHP Get path | domain | Queries of the particular url
<?php
$url = '//www.example.com/path?googleguy=googley';
// Prior to 5.4.7 this would show the path as "//www.example.com/path"
var_dump(parse_url($url));
//output will be like
// array(3) {
// ["host"]=>
// string(15) "www.example.com"
// ["path"]=>
// string(5) "/path"
// ["query"]=>
// string(17) "googleguy=googley"
// }
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment