This is a very silly question, but I don't know what's wrong. I can't get the value of a private variable through a public method. I'm using CodeIgniter.
class someClass extends MY_Model {
private $table = 'sometable';
public function getTable() {
return $this->table;
}
public function updateTable($data) {
$this->db->update($this->getTable(), $data);
}
}
When I call this method from the controller, I get this message:
Fatal error: Access level to someClass::$table must be public (as in class MY_Model) in /some/path/someclass.php on line 38
What have I done wrong? Thank you.