1

all is said in the title.

What is the difference between the three properties ? I've been testing the value of them and all what I can say is they are similar. However because I'm a standard freak, I'd like to know if there are some subtlety between them so I can avoid bad coding or being stuck later in some unexpected behavior.

vdegenne
  • 12,272
  • 14
  • 80
  • 106
  • You can refer http://stackoverflow.com/questions/279966/php-self-vs-path-info-vs-script-name-vs-request-uri – Abhishek Saha Jun 07 '13 at 09:14
  • downvoting is not fair, ok i didn't check well if an answer was already posted but just closing seems the proper decision. Indeed the question was not out of the rules of SO. – vdegenne Jun 07 '13 at 09:24

1 Answers1

2

'PHP_SELF'

The filename of the currently executing script, relative to the document root. For instance, $_SERVER['PHP_SELF'] in a script at the address http://example.com/test.php/foo.bar would be /test.php/foo.bar. The FILE constant contains the full path and filename of the current (i.e. included) file. If PHP is running as a command-line processor this variable contains the script name since PHP 4.3.0. Previously it was not available.

'SCRIPT_NAME'

Contains the current script's path. This is useful for pages which need to point to themselves. The FILE constant contains the full path and filename of the current (i.e. included) file.

'REQUEST_URI'

The URI which was given in order to access this page; for instance, '/index.html'.

Abhishek Saha
  • 2,564
  • 1
  • 19
  • 29