In PHP, how can I check if the current page has www in the url or not?
E.g if the user is on http://www.example.com/something , how can I find that there\'s www in t
array_shift(explode(".",$_SERVER['HTTP_HOST']));
Should work, then examine the array for the presence of www. If you are simply trying to remove or force www, then a .htaccess rule is by far superior to PHP for that job.