[development] Convention for accessing global variables
brian at brianvuyk.com
Wed Dec 9 20:45:02 UTC 2009
Obviously, there are two ways to access global variables.
1. Via the global keyword:
2. By accessing the $GLOBALS array directly:
Is there an established convention for this within Drupal core? The
majority of cases in HEAD use the global keyword (~470) instead of
accessing the $GLOBALS array (~40 cases). Is this something that should
be made a coding style issue for consistency across the codebase?
As a sidenote, accessing the $GLOBALS array directly in on average 25%
faster than using the global keyword. Of course, both run fast enough
that the difference is hardly noticeable.
More information about the development