On Fri, 2006-03-03 at 16:19 -0500, tedd wrote:
> Perhaps I'm fortunate, but I usually find a way around using Globals.
> And since I've been coding in PHP, I've never been forced to use them.
>
Just my 2c...
In our framework, I use globals as well, although I do tend to agree
with Tedd regardin
Andreas Korthaus wrote:
Hi Gustav!
Gustav Wiberg wrote:
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!
Ok, so what's your r
So what's the way [using Globals] you'd recommend and why?
best regards
Andreas
Andreas:
I have to agree with Gustav on this -- I very seldom use Globals. I
might use one for debugging, but not for finished code. Their use
simply creates problems in porting code, keeping things modular, and
On Fri, 2006-03-03 at 14:53, Andreas Korthaus wrote:
>
> - use a factory/singleton, which is not so much better than a global
> variable (and again, what about config-data?).
I use a global configuration to register database connection params.
InterJinn uses something like the following:
$GLOBAL
- Original Message -
From: "Andreas Korthaus" <[EMAIL PROTECTED]>
To: ; "Gustav Wiberg" <[EMAIL PROTECTED]>
Sent: Friday, March 03, 2006 8:53 PM
Subject: Re: [PHP] Coding Practice: Use global $var or pass in by refernce
Hi Gustav!
Gustav Wiberg wrot
I would go for:
- you can create a new instance ("new DB") in every methode (but you
usually only want a single DB-connection per script, and where do you
pass config-data to access the DB?) or
This way the code keeps well organized and about the use of only one
connection I wouldn't worry
Hi Gustav!
Gustav Wiberg wrote:
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!
Ok, so what's your recommendation to solve the
- Original Message -
From: "Mark Steudel" <[EMAIL PROTECTED]>
To:
Sent: Friday, March 03, 2006 7:46 PM
Subject: [PHP] 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 varia
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
9 matches
Mail list logo