Given the class definition:
<?php
class Caller {
private $x = array('a' => false);
function __set($name, $value) {
echo "setting\n";
$this->x[$name] = 'foo'; // intentially ignore value
}
function __get($name) {
echo "getting\n";
return $this->x[$name];
}
}
$foo = new Caller();
$b = $foo->a = 'bar';
echo "b is " . $b . "\n";
/* output:
setting
b is bar
*/
?>
I sort of expected both __set and __get to be called. Is it
concievable to have them both called?
The other alternative If possible, is allowing a return value
from __set() and using that value for the rest of the expression.
Curt
--
First, let me assure you that this is not one of those shady pyramid schemes
you've been hearing about. No, sir. Our model is the trapezoid!
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php