Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:11363 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 69843 invoked by uid 1010); 20 Jul 2004 04:13:15 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 69819 invoked from network); 20 Jul 2004 04:13:15 -0000 Received: from unknown (HELO took.shire) (68.122.184.4) by pb1.pair.com with SMTP; 20 Jul 2004 04:13:15 -0000 Received: (qmail 69370 invoked by uid 1001); 20 Jul 2004 04:26:46 -0000 Date: Tue, 20 Jul 2004 04:26:46 +0000 To: internals@lists.php.net Message-ID: <20040720042646.GE45209@bagend.shire> Mail-Followup-To: internals@lists.php.net Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.4.1i Subject: Chaining __set and __get in an expression From: curt@php.net (Curt Zirzow) Given the class definition: 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!