Re: global HTTP_(POST|GET|SESSION|SERVER|COOKIE)_VARS;
| From: | Cynic | Date: | Mon, 02 Jul 2001 13:20:33 +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-58688@lists.php.net to get a copy of this message | ||
At 14:07 7/2/2001, Derick Rethans wrote the following:
--------------------------------------------------------------
>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))
encapsulation!
>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).
It will also (IMNSHO) lessen the readability of the code. And slow down
things pretty much -- all that copying all over the place. I don't like it.
And $GET_A['var'] looks like a function pointer to some fetching function,
$POST['var'] would post $var somewhere... Dunno what would $COOKIE_A do. :)
PHP is my primary language (99% of time && work done in it).
>regards,
>
>Jani Taskinen
>Derick Rethans
cynic@mail.cz
-------------
And the eyes of them both were opened and they saw that their files
were world readable and writable, so they chmoded 600 their files.
- Book of Installation chapt 3 sec 7