Skip to content

Instantly share code, notes, and snippets.

@yokesharun
Created February 9, 2016 07:37
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yokesharun/a349f7297674c3eb1354 to your computer and use it in GitHub Desktop.
Save yokesharun/a349f7297674c3eb1354 to your computer and use it in GitHub Desktop.
PHP compare the domain with two urls and match it
<?php
$url1 = parse_url("http://www.google.co.uk");
$url2 = parse_url("http://www.google.co.uk/pages.html");
if ($url1['host'] == $url2['host']){
//matches
}else{
// not matches
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment