Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:47355 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 96527 invoked from network); 17 Mar 2010 13:55:58 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 17 Mar 2010 13:55:58 -0000 Authentication-Results: pb1.pair.com smtp.mail=mathieu.suen@easyflirt.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=mathieu.suen@easyflirt.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain easyflirt.com designates 91.199.255.56 as permitted sender) X-PHP-List-Original-Sender: mathieu.suen@easyflirt.com X-Host-Fingerprint: 91.199.255.56 python-06.easyrencontre.com Linux 2.6 Received: from [91.199.255.56] ([91.199.255.56:55871] helo=mail.easyflirt.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 02/73-06256-A6FD0AB4 for ; Wed, 17 Mar 2010 08:55:56 -0500 Received: from [192.168.0.51] (office.easyrencontre.com [78.155.152.6]) by mail.easyflirt.com (Postfix) with ESMTPSA id C5D876374CF for ; Wed, 17 Mar 2010 14:55:49 +0100 (CET) Message-ID: <4BA0DF61.1010907@easyflirt.com> Date: Wed, 17 Mar 2010 14:55:45 +0100 User-Agent: Thunderbird 2.0.0.23 (X11/20090817) MIME-Version: 1.0 To: internals@lists.php.net Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Assign array with __get From: mathieu.suen@easyflirt.com ("mathieu.suen") Hi, I came across a strange behavior when using the magic method __get and some instance variable that should be an array. Consider the following example: class A { public function __get($name) { $this->$name = array(); return $this->$name; } public function test() { $this->_zork['bar'] = 67; } } $a = new A; $a->test(); var_dump($a); So could someone explain me what is the semantic of the above statements? Thanks -- Mathieu Suen