note 78115 deleted from language.oop5.overloading by levim
| From: | levim@php.net | Date: | Sun, 15 Nov 2015 15:46:00 +0000 |
| Subject: | note 78115 deleted from language.oop5.overloading by levim | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-204152@lists.php.net to get a copy of this message | ||
Note Submitter: bgoldschmidt at rapidsoft dot de
----
"These methods will only be triggered when your object or inherited object doesn't contain
the member or method you're trying to access."
is not quite correct:
they get called when the member you trying to access in not visible:
<?php
class test {
public $a;
private $b;
function __set($name, $value) {
echo("__set called to set $name to $value\n");
$this->$name = $value;
}
}
$t = new test;
$t->a = 'a';
$t->b = 'b';
?>
Outputs:
__set called to set b to b
Be aware that set ist not called for public properties