{"id":26,"date":"2014-09-23T17:58:00","date_gmt":"2014-09-23T17:58:00","guid":{"rendered":"http:\/\/396@jodohost.com\/\/blog\/"},"modified":"2023-01-05T16:16:02","modified_gmt":"2023-01-05T16:16:02","slug":"the-use-of-the-undefined-constant-request_uri","status":"publish","type":"post","link":"http:\/\/www.jodohost.com\/blog\/index.php\/2014\/09\/23\/the-use-of-the-undefined-constant-request_uri\/","title":{"rendered":"The use of the undefined constant REQUEST_URI"},"content":{"rendered":"<p>$_SERVER[REQUEST_URI]\u00a0is 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&#8217;s still not good practice.<\/p>\n<p>EDIT: Well unless you define a constant called REQUEST_URI in your example script, \u00a0$_SERVER[&#8216;REQUEST_URI&#8217;]\u00a0is the standard method and what you should be using.<\/p>\n<p>$_SERVER[&#8220;REQUEST_URI&#8221;]\u00a0also 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.<\/p>\n<p> ]]><\/p>\n","protected":false},"excerpt":{"rendered":"<p>$_SERVER[REQUEST_URI]\u00a0is 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&#8217;s still not good practice. EDIT: Well unless you define a constant called [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[2],"tags":[],"_links":{"self":[{"href":"http:\/\/www.jodohost.com\/blog\/index.php\/wp-json\/wp\/v2\/posts\/26"}],"collection":[{"href":"http:\/\/www.jodohost.com\/blog\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.jodohost.com\/blog\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.jodohost.com\/blog\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.jodohost.com\/blog\/index.php\/wp-json\/wp\/v2\/comments?post=26"}],"version-history":[{"count":1,"href":"http:\/\/www.jodohost.com\/blog\/index.php\/wp-json\/wp\/v2\/posts\/26\/revisions"}],"predecessor-version":[{"id":320,"href":"http:\/\/www.jodohost.com\/blog\/index.php\/wp-json\/wp\/v2\/posts\/26\/revisions\/320"}],"wp:attachment":[{"href":"http:\/\/www.jodohost.com\/blog\/index.php\/wp-json\/wp\/v2\/media?parent=26"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.jodohost.com\/blog\/index.php\/wp-json\/wp\/v2\/categories?post=26"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.jodohost.com\/blog\/index.php\/wp-json\/wp\/v2\/tags?post=26"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}