[snip]
I made one. Here:

        // Alter variables for the versions prior to 4.1.0
        // NOTE: $_REQUEST global variable is NOT supported.
        if(strnatcasecmp('4.1.0', PHP_VERSION)>=0) {
                foreach(Array(
                         '_GET'      => 'HTTP_GET_VARS'
                        ,'_POST'     => 'HTTP_POST_VARS'
                        ,'_COOKIE'   => 'HTTP_COOKIE_VARS'
                        ,'_SESSION'  => 'HTTP_SESSION_VARS'
                        ,'_SERVER'   => 'HTTP_SERVER_VARS'
                        ,'_ENV'      => 'HTTP_ENV_VARS'
                        ,'_FILES'    => 'HTTP_POST_FILES'
                        ) as $transvar['new']=>$transvar['old']) {
                        if(isset($$transvar['old']) and is_array($$transvar['old'])) {
                                $GLOBALS[$transvar['new']] = &$$transvar['old'];
                        }
                }
                // Unset transvar, we do not need it anymore.
                unset($transvar);
        }
One thing to add:

ever asked yourself why people, after retrieving some data from DB call
their variables similar like: $recID and not just $id or $dbTime and not
just $time? Obviously to differentiate between the origins of data. Now,
if you understood what I meant here, why using $id within the script
instead of $_GET['id'] or $_SESSION['id'] ? Isn't is a cleaner, rather
elegant code? That is a good practice. You shouldn't be lazy writing 6
more characters for a variable... You'd do that anyway for the data
names because would be confused :)
[/snip]


This points out a system wide concern, self-taught developers (Not that
there is anything wrong with that! :^]) and coders who have come to the
party from a new path where they learned there thing by reading, surfing,
and hacking until they got it right. They have missed out on things like
significant notation or Hungarian notation, planning, charting, and many
other factors that enter into the equation. The recent register globals
discussion points this out clearly.

Having worked with a couple of developers who came down this path and
watching the outright surprise and shock on their faces when flowcharts,
variable keys, and other pre-code documentation are requested in project
meetings it is no surprise that many find the register globals update
inconvenient. What if PHP had strongly typed variables? (BTW, using the
$_GET, $_POST, etc is a move in that direction, a good thing ...) Maxim, you
are dead on with this!

Here is some good reading for variable naming, a good place to start;

http://www.google.com/search?hl=en&ie=UTF-8&oe=UTF-8&q=Hungarian+notation

Jay

"Now, if I could only get a book deal to write about this ...."



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to