Thank you for that great article. What is the difference between the following code and yours?
class Foo {
private $vars = array();
public function __get($key) {
$ret = NULL;
if(isset($this->vars[$key]))
$ret = $this->vars[$key];
return $ret;
}
public function __set($key, $val) {
$this->vars[$key] = $val;
}
public function __isset($key) {
return isset($this->vars[$key]);
}
public function __unset($key) {
unset($this->vars[$key]);
}
}
I do not understand the advantage of using BetterAccess.
Thank you in advance for your answer
Best regards,
Tim
class Foo { private $vars = array(); public function __get($key) { $ret = NULL; if(isset($this->vars[$key])) $ret = $this->vars[$key]; return $ret; } public function __set($key, $val) { $this->vars[$key] = $val; } public function __isset($key) { return isset($this->vars[$key]); } public function __unset($key) { unset($this->vars[$key]); } }I do not understand the advantage of using BetterAccess. Thank you in advance for your answer Best regards, Tim