How can I use class instance inside independent method? I some file have:
global $l;
$l = new l('bg');
include('second.php');
In second.php I have:
function a() {
print_r($l);
}
$l is coming like NULL;
class l declaration:
class l {
var $lang = array();
function l($lang) {
}
function g($string) {
}
}
My question - how can I use $l instance inside of my function a. Thanks.
$lis not in scope,global $lwould work, but you could also pass it to the function as a parameter (better).