Login to Members Area

Choose the service you want to log in
24x7x365 Presence
Live Chat

Hosting Blog


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.

Shubham Tuesday 23 September 2014 - 5:58 pm | | Default

No comments

(optional field)
(optional field)

Comment moderation is enabled on this site. This means that your comment will not be visible until it has been approved by an editor.

Remember personal info?
Small print: All html tags except <b> and <i> will be removed from your comment. You can make links by just typing the url or mail-address.