Advertisement
phpaddict

Strip domain from url

Jul 9th, 2014
241
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.21 KB | None | 0 0
  1. function strip_domain($url = '')
  2. {
  3.     return preg_replace('/^http(s)?:\/\/([^\/]+).*$/', "$2", $url);
  4. }
  5.  
  6. print_r(strip_domain('http://www.youtube.com/watch?v=kEvRlU6S9s8&feature=kp'));
  7. // will print www.youtube.com
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement