Rather than write a huge list of properties used by a class I want to know if I can dynamically generate them when needed. I have looked and __set and __get but I am not sure how (or if) I use them with what I am trying to do.
The function I have at the moment is this (obviously doesn't work):
public function getShowHelpingDetails($id) {
$this->show_id = $id;
$result = $this->selectRecord($this->table, $this->show_id, '*', '', 'show_');
foreach ($result as $key => $value) {
$this->{$key} = $value;
}
}
And then trying to access the properties like this:
$h = new ShowHelping;
$helping = $h->getShowHelpingDetails($show_id);
echo $helping->time;
Can anyone help me with this and if not possible advise of a better way to set my class properties without huge lists of them?