Re: global HTTP_(POST|GET|SESSION|SERVER|COOKIE)_VARS;

From: Date: Mon, 02 Jul 2001 13:10:18 +0000
Subject: Re: global HTTP_(POST|GET|SESSION|SERVER|COOKIE)_VARS;
References: 1  Groups: php.dev 
Request: Send a blank email to php-dev+get-58687@lists.php.net to get a copy of this message
(a) I agree that the names are long (b) Remember that you can change the name by simply assigning it around (e.g., $GET_A = $HTTP_GET_VARS) (c) I think that $GET_A is ugly :) I'd go for something along the lines of $__GET (d) Having these variables available on every function means that it's going to slow things down, so it's a no-no. What we can do is do something along the lines of $GLOBALS - where it is available in every function that *uses* it. The drawback here is that it means it will not be available via indirect reference (i.e., $foo = "__GET", $$foo["bar"]). I don't think it's a serious drawback though. Zeev At 15:07 2/7/2001, Derick Rethans wrote:
Hello list, sometimes I use PHP too, and today I noticed the things I described here. Per coincidence, Jani, who is working on the new bugsystem, had the same thoughts about this. I'll describe the problem now: All the arrays which hold the vars are not in de global name space, you you will always need to use the "global" keyword, or something like $GLOBALS["HTTP_SESSION_VARS"]["username"]; As you all can see, that's way to long and cumbersome to type. Just see this example: global $HTTP_GET_VARS; global $HTTP_POST_VARS; global $HTTP_COOKIE_VARS;
if(     empty($HTTP_GET_VARS['PHPSESSID'])  &&
        empty($HTTP_POST_VARS['PHPSESSID']) &&
        empty($HTTP_COOKIE_VARS['PHPSESSID']) &&
        !empty($sessid)
I think this looks much better: if ( empty ($GET_A['PHPSESSID']) &&
     empty ($POST_A['PHPSESSID']) &&
     empty ($COOKIE_A['PHPSESSID']) &&
     !empty ($sessid))
I propose to change the names of the arrays and to make these arrays available in all functions, this will both eliminate the use of the global keyword, and will shorten the names significantly. This will speed op coding of course. Our proposal is to use the now second word of the array, postfixed by _A (array). regards, Jani Taskinen Derick Rethans -- PHP Development Mailing List <http://www.php.net/> To unsubscribe, e-mail: php-dev-unsubscribe@lists.php.net For additional commands, e-mail: php-dev-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net
-- Zeev Suraski <zeev@zend.com> CTO & co-founder, Zend Technologies Ltd. http://www.zend.com/

« previous php.dev (#58687) next »