views:

197

answers:

3
+5  A: 

The manual about the directive might help you a bit more : variables_order (quoting) :

Sets the order of the EGPCS (Environment, Get, Post, Cookie, and Server) variable parsing. For example, if variables_order is set to "SP" then PHP will create the superglobals $_SERVER and $_POST, but not create $_ENV, $_GET, and $_COOKIE. Setting to "" means no superglobals will be set.

Also note (quoting again) :

The content and order of $_REQUEST is also affected by this directive.

I suppose this option was more important a while ago, when register_globals was still something used, as the same page states (quoting) :

If the deprecated register_globals directive is on (removed as of PHP 6.0.0), then variables_order also configures the order the ENV, GET, POST, COOKIE and SERVER variables are populated in global scope. So for example if variables_order is set to "EGPCS", register_globals is enabled, and both $_GET['action'] and $_POST['action'] are set, then $action will contain the value of $_POST['action'] as P comes after G in our example directive value.

I don't see what I could add ; did this help ?
Or is this something in this that causes you a problem ?

Pascal MARTIN
@Pascal MARTIN: am sorry. :(, why we need to set an order for these variables. i dont understand?
coderex
If you have a variable named the same way that is passed both in $_GET and $_COOKIE, when merging $_GET, $_POST, $_COOKIE, ... into $_REQUEST, PHP has to know which one of those has to be used first... And which one of those will override the first one. This is not used much today (at least, if we don't use $_REQUEST), but when register_globals was used, it was not uncommon to depend on this order to have the right values set in our variables. ;; you can have an 'action' in $_GET and another 'action' in $_COOKIe ; but you can have only one in $_REQUEST : which one will it be ? ;-)
Pascal MARTIN
yea i got it!! Thanks man !! :-)This was the answer really i want :-). c u on next post :)
coderex
You're welcome :-) Have fun!
Pascal MARTIN
A: 

It controls the order in which the global variables $_GET, $_POST, etc. are defined by PHP. The letters just stand for categories, e.g., G for $_GET. I seriously doubt you want to mess with that setting.

Eevee
A: 

The accepted answer above is good. But another important point to note here is that if any of these flags is not set, that variable will be empty when the script runs, i.e. if variables_order is set to "GPCS" the $_ENV variable will always be an empty array. Found this out the hard way.

Marco