function save() { $data = array(); $dump = print_r($this, 1); preg_match_all('/^\s+\[(\w+):private\]/m', $dump, $matches); foreach ($matches[1] as $property) { $data[$property] = $this->$property; } $this->db->update(POST_TABLE, $data, "id", $this->getId()); }