Topic awaiting preservation: Can you set a variable so it can be used through all functions? |
|
---|---|
Author | Thread |
Bipolar (III) Inmate From: Australia |
posted 05-13-2003 02:59
Just a quick question.. Is there a way to do it, rather then declaring a global variable in the functions you need, set them so they can be used through all functions? |
Maniac (V) Mad Scientist From: 100101010011 <-- right about here |
posted 05-13-2003 04:00
you can define your own constants (however once defined they can not be changed like a normal variable, they can just be redefined). I use this method for things like DB_NAME etc with MySQL and other site constants. |
Bipolar (III) Inmate From: Australia |
posted 05-13-2003 04:04
Thanks for that, yeh your right, its probalby unneccesary =/ |
Paranoid (IV) Mad Scientist with Finglongers From: Germany |
posted 05-13-2003 08:39
yeah, needing a global in every function, that is not a constant, is definatly a code smell! |