Forum Moderators: coopster
Hope everyone had a good new year!
I would like some clarity on constants and globals please; I know how to declare a constant:-
define('NAME', "matthew");
a constant called "matthew",
Globals, from what I can understand is simply:-
global $variable_name;
from within a function, literally asking php to look outside the function to find a variable called $variable_name.
My issue is, I have a constant set in one area and I would like to call this constant in another area, without having to re-declare it, whether this is the done thing or not i'm not sure? So now I am thinking could I set a constant as global and if so how do I do it, my aim is to just have this constant available throughout my script?
If anyone understands my request I would appreciate the help.
Cheers,
MRb
I think I have understood why I need to have the Constant re-defined, as the script assigns variables and constants in the flow of the document, the first instance will not have been set if I use, in this case the administration index.php file which is 1 directory down from the main index parsing file, in which the original constant is defined, and of course if the main parsing file isn't in use, the constant wont have been defined thus the value is not set.
I hope I make sense, and obviously I hope I'm right, which is possible that I am not..
Cheers for the help though DC.
MRb