[development] Convention for accessing global variables

Andrew Berry andrewberry at sentex.net
Thu Dec 10 02:01:26 UTC 2009


On 09/12/2009 3:45 PM, Brian Vuyk wrote:
> Is there an established convention for this within Drupal core?
I'm sure I'm not the only person who's done something like the following 
by mistake:

<?php

global $user;
// Do one thing like access $user->uid.
// Other, unrelated code.
$user = user_load(...);
// Boom!

This makes me think that standardizing on $GLOBALS would be a good 
thing. Can you link to where you found the 25% faster benchmark?

--Andrew


More information about the development mailing list