What is the difference between:
$_SERVER['SCRIPT_NAME']
and
$_SERVER['PHP_SELF']
Thank you.
$_SERVER['PHP_SELF'] Returns the filename of the currently executing script. $_SERVER['GATEWAY_INTERFACE'] Returns the version of the Common Gateway Interface (CGI) the server is using.
The $_SERVER['SERVER_ADDR'] returns the IP address (Internet Protocol address) of the host server. Following php code used $_SERVER['SERVER_ADDR'] to display the IP address of the host server.
They should contain the same information. However, historically and technically speaking, there is a difference between the two.
SCRIPT_NAME
is defined in the CGI 1.1 specification, and therefore is a standard. This means it should be available no matter what scripting language you're using.
PHP_SELF
is implemented directly by PHP, and as long as you're programming in PHP, it will be there.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With