Re: [PHP] Scope of Variables and use of global and this->var

2009-07-16 Thread Eddie Drapkin
On Thu, Jul 16, 2009 at 9:53 AM, Govinda wrote: > > On Jul 15, 2009, at 3:28 PM, tedd wrote: > >> My way -- every time I open a database, I do so by including the >> configuration.php file that holds the logon/password et other data to >> connect with the database. When I'm done with what I want fr

Re: [PHP] Scope of Variables and use of global and this->var

2009-07-16 Thread Govinda
On Jul 15, 2009, at 3:28 PM, tedd wrote: My way -- every time I open a database, I do so by including the configuration.php file that holds the logon/password et other data to connect with the database. When I'm done with what I want from the database, I close it. If one does not close i

Re: [PHP] Scope of Variables and use of global and this->var

2009-07-15 Thread tedd
At 12:21 PM +0200 7/14/09, Anton Heuschen wrote: In my index.php page I then use $dbconnect again but do I simply use $dbconnect again ... or must I say global $dbconnect and then use it in the rest of the DB calls? or use GLOBALS .. Anton: My way -- every time I open a database, I do so

Re: [PHP] Scope of Variables and use of global and this->var

2009-07-14 Thread Martin Scotta
do you need to use global? IMO you should use just 1 global variable, thats is what I call "entry point" My scripts looks like... require_once 'loader.php'; Loader::registerAutoload(); $foo = new Foo(); $foo->doStuff(); This way you can develop faster and do maintenance better avoiding problems

Re: [PHP] Scope of Variables and use of global and this->var

2009-07-14 Thread Darren Karstens
> Oh and if one class uses methods in another class do I instansiate a > new object of the other class I have seen use of OtherClass::Method >  is this better method of $obj = new OtherClass()  use The :: is used to access static methods of a class. Static methods can be used withou

Re: [PHP] Scope of Variables and use of global and this->var

2009-07-14 Thread Eric Butera
On Tue, Jul 14, 2009 at 6:21 AM, Anton Heuschen wrote: > This is just a general question, > > I am not 100% on when to use global $var , and $this->var  and how/what > about the GLOBAL vars > > Lets say I have one file I  call config.php here I connect to the db, to > ldap etc the con

[PHP] Scope of Variables and use of global and this->var

2009-07-14 Thread Anton Heuschen
This is just a general question, I am not 100% on when to use global $var , and $this->var and how/what about the GLOBAL vars Lets say I have one file I call config.php here I connect to the db, to ldap etc the connection "var" I can then use in a file on its own ... obviously aft