I need to access some variables of an external php file in most class functions. I have access as follows (and it works fine)
class test{
function a(){
global $myglobalvar ;
..
..
}
function b(){
global $myglobalvar ;
..
..
}
function c(){
global $myglobalvar ;
..
..
}
}
Is there a way that I can access $ myglobalvar in all functions of a class without declaring in each function? I read that this can be done by declaring only once in the class constructor, but I do not know how to do this. Thanks for any help.
source
share