public function __get($key) { if ($key == 'mysql') { if (is_null($this->mysql)) { $this->mysql = MySQLConnect::getConnect(); } return $this->mysql; } return parent::__get($key); }