----- Original Message -----
From: "Mark Steudel" <mark@xxxxxxxxxxxx>
To: <php-general@xxxxxxxxxxxxx>
Sent: Friday, March 03, 2006 7:46 PM
Subject: Coding Practice: Use global $var or pass in by refernce
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
Hi!
My oponion is that is insane to use global variables. The main drawback with
global variables is that is very easy to mix up variables, and keep track of
what variable belongs to what. So an advice: Don't use it!
/G
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php