PDA

View Full Version : question on globals


2bz2p
07-29-2008, 01:04 AM
hi,

If i put global $var1, $var2; in say my settings.inc.php with is included on all pages will that allows those perticular vars in and out of functions or does the global have to be inside the function

thanks
2b

davidj
07-29-2008, 08:09 AM
globals are used inside the function

2bz2p
07-29-2008, 01:58 PM
Yeah thats what I thought, PHP Should create a function that allows you to do something like that, yah know where you can define all the globals for everything in one shot.

Thanks again
2b

davidj
07-29-2008, 05:33 PM
you need to look into OOP as this requires you to declare your vars

2bz2p
07-29-2008, 07:14 PM
I am interested in it and I am sure that it would make my life 10x easier, but I am not sure if I am at that point yet or if I even know that point.

2b

davidj
07-29-2008, 08:01 PM
its not really a point where you say im ready

you understand the basic concept behind the code and therefore your ready

having your code in one place which you reuse

You could write a connection class and a login class which you can reuse in different apps