• 1-888-289-2246
  • 24x7x365 Presence

The use of the undefined constant REQUEST_URI


$_SERVER[REQUEST_URI] is syntactically incorrect and AFAIK will not run on a default installation of PHP 5. The array index is a string so it needs to be passed strings. I know PHP 4 converted undefined constants to strings inside the square brackets but it’s still not good practice.

EDIT: Well unless you define a constant called REQUEST_URI in your example script,  $_SERVER[‘REQUEST_URI’] is the standard method and what you should be using.

$_SERVER[“REQUEST_URI”] also works and while not wrong is slightly more work for the PHP interpreter so unless you need to parse it for variables it should not be used.

]]>