What is the best way to have a config consisting of a set of variables and error messages set in a class?
At the moment I have it at the top of each method that uses it. Some people may say that is bad practice, but I'm trying to see about another solution.
I was thinking about a class like:
class config {
function __construct(){
const var = "asdf";
const var2 = 2;
}
}
Not even sure the construct is needed ..and usage i would do something like config::var, but my variable formats are in the array types at the moment ($err['err_type'] = "error message";).. so is there anyway to preserve that format in a class, not sure if a constant can be assign as an array hehe.
Any help appreciated, thanks.