Displaying domain name only in PHP without www. or / or anything else.. ?

1 replies
The code below displays: domain.com/ but I would like to display just domain.com without the /

Code:
<?php $hostname = $_SERVER['SERVER_NAME']; $hostname = str_replace('www.', '', $hostname); echo $hostname . htmlentities($_SERVER['REQUEST_URI']);?>
Also how would I display domain.com in all uppercase letters; DOMAIN.COM

Thanks in advance!
#displaying #domain #php #www
  • Profile picture of the author IdeaBox
    add another str_replace to replace the /.. to make it uppercase do


    $hostname = strtoupper($hostname);
    {{ DiscussionBoard.errors[8466632].message }}

Trending Topics