Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:7090 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 97742 invoked by uid 1010); 14 Jan 2004 12:04:43 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 97713 invoked from network); 14 Jan 2004 12:04:42 -0000 Received: from unknown (HELO mail.zend.com) (192.117.235.230) by pb1.pair.com with SMTP; 14 Jan 2004 12:04:42 -0000 Received: (qmail 12971 invoked from network); 14 Jan 2004 12:04:40 -0000 Received: from localhost (HELO zeev-laptop.zend.com) (127.0.0.1) by localhost with SMTP; 14 Jan 2004 12:04:40 -0000 Reply-To: zeev@zend.com Message-ID: <5.1.0.14.2.20040114121104.091f5ec0@localhost> X-Sender: zeev@localhost X-Mailer: QUALCOMM Windows Eudora Version 5.1 Date: Wed, 14 Jan 2004 14:02:59 +0200 To: John Coggeshall Cc: PHP Internals In-Reply-To: <1074072793.19144.50.camel@coogle.localdomain> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; format=flowed Subject: Re: [PHP-DEV] Weird. From: zeev@zend.com (Zeev Suraski) References: <1074072793.19144.50.camel@coogle.localdomain> At 11:33 14/01/2004, 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 :) > >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"; > > } > } > >?> I don't see anything odd in here. All of the assignments, except for the first one ('A'), assign to $this->"" (because $myvar, ${'myvar'} (which is the same as $myvar) and ${'$myvar'} (which is basically $"") are all non existent variables which implicitly evaluate to "". Try to turn on E_ALL, it should give you some insight... Zeev