Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:11374 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 83001 invoked by uid 1010); 20 Jul 2004 15:50:27 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 82907 invoked from network); 20 Jul 2004 15:50:26 -0000 Received: from unknown (HELO theta.altoona-pa.com) (209.161.72.28) by pb1.pair.com with SMTP; 20 Jul 2004 15:50:26 -0000 Received: from IONZOFT-JEG (dpvc-207-68-114-163.alt.east.verizon.net [207.68.114.163]) by theta.altoona-pa.com (Postfix) with ESMTP id E28ED14D46 for ; Tue, 20 Jul 2004 11:50:25 -0400 (EDT) Date: Tue, 20 Jul 2004 11:50:21 -0400 X-Mailer: The Bat! (v2.11.02) Business Reply-To: Jason Garber Organization: IonZoft, Inc. X-Priority: 3 (Normal) Message-ID: <1123567599.20040720115021@ionzoft.com> To: internals@lists.php.net In-Reply-To: <20040720042646.GE45209@bagend.shire> References: <20040720042646.GE45209@bagend.shire> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] Chaining __set and __get in an expression From: jason@ionzoft.com (Jason Garber) Hello Curt, From=20http://us2.php.net/manual/en/language.operators.assignment.php "The value of an assignment expression is the value assigned. That is, the value of "$a =3D 3" is 3." I take this to mean that ($foo->a =3D 'bar') will always return 'bar' and that is a core feature of the language. Remember that $foo->a is the left hand operand, and is only receiving the value. It is the =3D operator that returns the value of the expression. It may also be worth noting that the Associativity of the `=3D` operator is "Right". --=20 Best regards, Jason mailto:jason@ionzoft.com Tuesday, July 20, 2004, 12:26:46 AM, you wrote: CZ> Given the class definition: CZ> class Caller { CZ> private $x =3D array('a' =3D> false); CZ> function __set($name, $value) { CZ> echo "setting\n"; CZ> $this->x[$name] =3D 'foo'; // intentially ignore value CZ> } CZ> function __get($name) { CZ> echo "getting\n"; CZ> return $this->x[$name]; CZ> } CZ> } CZ> $foo =3D new Caller(); $b =3D $foo->>a =3D 'bar'; CZ> echo "b is " . $b . "\n"; CZ> /* output: CZ> setting CZ> b is bar CZ> */=20 ?>>=20 CZ> I sort of expected both __set and __get to be called. Is it CZ> concievable to have them both called? CZ> The other alternative If possible, is allowing a return value CZ> from __set() and using that value for the rest of the expression. CZ> Curt CZ> --=20 CZ> First, let me assure you that this is not one of those shady pyramid sc= hemes CZ> you've been hearing about. No, sir. Our model is the trapezoid!