Coding Practice: Use global $var or pass in by refernce

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I was wondering what the general rule on using the global driective versus
passing in a variable by reference, why you should or shouldn't, etc.
 
e.g.
 
function ()
{
    global $db;
 
    $res =& $db->query( "SQL");
}
 
or
 
function ( &$db )
{
 
    $res =& $db->query( "SQL");
}

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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux