So, I’ve got my setup like this:
class System extends mysqli{
function __construct(){
//user variables such as $this->username are returned here
}
}
$sys = new System();
class Design{
function setting(){
echo $sys->username;
}
}
$design = new Design();
Yet the Design class doesn’t echo the username. I can echo the username outside of the Design class, but not inside the design class. How can I go about this?
Everyone else’s answer is fine, but you can inject the dependency on system very nicely: