The source code to print the server name or website name is given below. The given program is compiled and executed successfully.
<?php
//PHP program to print the
//server name or website name.
$ServerName = $_SERVER['SERVER_NAME'];
printf("Server Name: %s<br>", $ServerName);
?>
Output:
Server Name: www.includehelp.com
Explanation:
In the above program, we used $_SERVER['SERVER_NAME'] super global that returns the server or website name, which is assigned to the variable $ServerName. After that, we printed the server or website name on the webpage.
Program/Source Code:
The source code to print the server name or website name is given below. The given program is compiled and executed successfully.
Output:
Explanation:
In the above program, we used $_SERVER['SERVER_NAME'] super global that returns the server or website name, which is assigned to the variable $ServerName. After that, we printed the server or website name on the webpage.
need an explanation for this answer? contact us directly to get an explanation for this answer