0
Can someone explain the difference between the use of the $_SERVER as script name and this one for host name?
Also there's a lot of main elements that can be used that confuses me on how this are used on the actual code. Like, can someone give a scenario or an example each? Thank you.
2 odpowiedzi
0
script name: the name of your PHP file which you are currently running. For example you have php file called test.php which has following code:
<?php
echo '$_SERVER ["SCRIPT_NAME"]';
?>
it will return test.php....which is the name of currently runninh php file or script.
But host name is different. Remember when u setup simple server in ur machine we call it localhost. and if ur using hosting companies like Hostgator.com, they have their own server name which here called as host name....
0
$_SERVER is a superglobal variable on PHP. Here on this link, you can find all the uses for the variable:
http://php.net/reserved.variables.server
Hope it helps to you.