Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:47356 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 1219 invoked from network); 17 Mar 2010 14:11:24 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 17 Mar 2010 14:11:24 -0000 Authentication-Results: pb1.pair.com header.from=ionut.g.stan@gmail.com; sender-id=pass; domainkeys=bad Authentication-Results: pb1.pair.com smtp.mail=ionut.g.stan@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.218.214 as permitted sender) DomainKey-Status: bad X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 X-PHP-List-Original-Sender: ionut.g.stan@gmail.com X-Host-Fingerprint: 209.85.218.214 mail-bw0-f214.google.com Received: from [209.85.218.214] ([209.85.218.214:56485] helo=mail-bw0-f214.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 60/10-00341-B03E0AB4 for ; Wed, 17 Mar 2010 09:11:24 -0500 Received: by bwz6 with SMTP id 6so1141490bwz.33 for ; Wed, 17 Mar 2010 07:11:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from :user-agent:mime-version:to:subject:references:in-reply-to :content-type:content-transfer-encoding; bh=Jv1lNxIu8bYc+rHEQYll+WwcBpivvUJRC5JncMIqhu8=; b=d7aw3yd/+b1ToeiMmFzZCoU5laG6Q7aSSTQyMum6xYhw+5wMDA6uud8LvsI+xzSxEd BB1rq2i934xHS2n7/xJqwis44DA2iAlF6YUL0auWiIZUtoWSgbdmczaB57lCg67ZXkJ0 4WLR0jkMzKabiE/vtvQIW7M2HRym0WI7SVKnM= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:content-type:content-transfer-encoding; b=JjQcjQHm9kwuaLxFhxKtNmrtOltON+g3qc/cAO4LHAVzN31zshgnksgqDjQlsBoiG4 iMRgvCAiuzWCAVxREURQrf1r6syKivt83VDQxZgUsEAUxqRRvBOf+KsvW3/SnzkYQIbI gapN2hQaFAADDeYN6uZxMVVNqGdnGvYMIcOqw= Received: by 10.204.139.207 with SMTP id f15mr1520968bku.196.1268835080331; Wed, 17 Mar 2010 07:11:20 -0700 (PDT) Received: from l.local ([82.208.177.66]) by mx.google.com with ESMTPS id 14sm4549246bwz.2.2010.03.17.07.11.18 (version=SSLv3 cipher=RC4-MD5); Wed, 17 Mar 2010 07:11:19 -0700 (PDT) Message-ID: <4BA0E39C.7020600@gmail.com> Date: Wed, 17 Mar 2010 16:13:48 +0200 User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.1.8) Gecko/20100227 Thunderbird/3.0.3 MIME-Version: 1.0 To: internals@lists.php.net References: <4BA0DF61.1010907@easyflirt.com> In-Reply-To: <4BA0DF61.1010907@easyflirt.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] Assign array with __get From: ionut.g.stan@gmail.com ("Ionut G. Stan") Hi, This is interesting and it appears the following change makes the snippet work as expected: public function &__get($name); On 3/17/10 3:55 PM, mathieu.suen wrote: > 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 > > > -- Ionut G. Stan I'm under construction | http://blog.igstan.ro/