db = new \Mysqli($this->server, $this->username, $this->password, $this->database); if(!$this->db->set_charset("utf8")) { printf("Error loading character set utf8: %s\n", $this->db->error); exit(); } } public function __destruct() { $this->db->close(); } /** * @return Mysqli */ protected function getDb() { return $this->db; } protected function makeValuesReferenced(&$arr) { $refs = array(); foreach($arr as $key => $value) $refs[$key] = &$arr[$key]; return $refs; } }