Problem with variable scope

file: report_generator.php

class reportGenerator


file: customer_report.php

includes ("…/language/english.php");
$r1=new reportGenerator();

My problem is finding a way to use all the variables in the english.php file without passing them into the reportGenerator class. I would have to make a ton of changes to a lot of files even if I had to pass only an array of variables in.

How can I use the variables from english.php without passing them into the class?

NOTE: If I just include the variables in the class it will not work because the class files are included in other files which will mess up the path.

I found a way around it.

I made the language file a class so I could just pass in the object. It took about an hour or so, but it was worth it.

Sponsor our Newsletter | Privacy Policy | Terms of Service