Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:7089 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 38804 invoked by uid 1010); 14 Jan 2004 10:10:01 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 38780 invoked from network); 14 Jan 2004 10:10:00 -0000 Received: from unknown (HELO mail.internet-factory.de) (62.134.147.34) by pb1.pair.com with SMTP; 14 Jan 2004 10:10:00 -0000 Received: from pharao.lammfellpuschen.de (jeanette@p50821CC6.dip.t-dialin.net [80.130.28.198]) by mail.internet-factory.de (8.12.8/8.12.5/1.1) with SMTP id i0EA9hrV011949; Wed, 14 Jan 2004 11:09:44 +0100 Received: by pharao.lammfellpuschen.de (sSMTP sendmail emulation); Wed, 14 Jan 2004 11:09:42 +0100 Date: Wed, 14 Jan 2004 11:09:42 +0100 To: John Coggeshall Cc: PHP Internals Message-ID: <20040114100942.GU1711@pharao.serveftp.org> Reply-To: messju mohr References: <1074072793.19144.50.camel@coogle.localdomain> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1074072793.19144.50.camel@coogle.localdomain> User-Agent: Mutt/1.4.1i X-WebServ-MailScanner-Information: Please contact the ISP for more information X-WebServ-MailScanner: Found to be clean X-WebServ-MailScanner-SpamCheck: not spam, SpamAssassin (score=-3.173, required 5, AWL -2.01, BAYES_00 -4.90, CASHCASHCASH 0.00, RCVD_IN_NJABL 0.10, RCVD_IN_NJABL_DIALUP 3.54, RCVD_IN_SORBS 0.10) Subject: Re: [PHP-DEV] Weird. From: messju@lammfellpuschen.de (messju mohr) On Wed, Jan 14, 2004 at 04:33:13AM -0500, John Coggeshall wrote: > I know that this issue to some extent or another has been brought up > before, but I just wanted to make sure that this is really how things > are supposed to work... Apparently the statements setting B C and D > are all equivalent. > > This could be absolutely bogus, but I thought maybe someone could > explain briefly why if it is :) "B" and "C" are equivalent but "D" is somethig else. "B" and "C" set the property named by the value of $myvar. in "D" the variable-name is '$myvar' (not 'myvar'). if you set $myvar = "foo"; ${'$myvar'} = "bar"; then "B" and "C" will set $this->foo, but "D" will set $this->bar. it's not that bogus. greetings messju > John > > class weird { > > var $myvar; > > function __construct() { > > $this->myvar = "A"; > $this->$myvar = "B"; > $this->${'myvar'} = "C"; > $this->${'$myvar'} = "D"; > > echo 'this->myvar: '.$this->myvar."\n"; > echo 'this->$myvar: '.$this->$myvar."\n"; > echo 'this->${\'myvar\'}: '.$this->${'myvar'}."\n"; > echo 'this->${\'$myvar\'}: '.$this->${'$myvar'}."\n"; > echo 'this->$$$$$$$myvar: '.$this->$$$$$$$myvar."\n"; > echo 'this->$$$$$$${\'$$$myvar\'}: ' . > $this->$$$$$$${'$$$myvar'}."\n"; > > } > } > > ?> > -- > -=~=--=~=--=~=--=~=--=~=--=~=--=~=--=~=--=~=--=~=--=~=--=~=- > John Coggeshall http://www.coggeshall.org/ > The PHP Developer's Handbook http://www.php-handbook.com/ > -=~=--=~=--=~=--=~=--=~=--=~=--=~=--=~=--=~=--=~=--=~=--=~=- > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php