Getting server's real name (hostname) in PHP

I have joined Google and none of the tools on eKstreme.com are official Google tools nor are they endorsed by Google. See this.

It is sometimes necessary to figure out the real server name. There are several ways to do this, but in PHP, a simple way is this:

$SERVER_NAME = $_SERVER["SERVER_NAME"];
$IP = gethostbyname ($SERVER_NAME);
$server = gethostbyaddr($IP);
echo "<br>Server IP: $IP";
echo "<br>Server Name: $server";

If you do not want to see the IP address of your website, you can use this single line of code:

echo "Server Name: " . gethostbyaddr (gethostbyname ($_SERVER["SERVER_NAME"]));