Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:59902 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 69458 invoked from network); 13 Apr 2012 19:19:37 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 13 Apr 2012 19:19:37 -0000 Authentication-Results: pb1.pair.com header.from=dsnytkine@Ultralogistics.com; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=dsnytkine@Ultralogistics.com; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain Ultralogistics.com from 64.197.110.172 cause and error) X-PHP-List-Original-Sender: dsnytkine@Ultralogistics.com X-Host-Fingerprint: 64.197.110.172 thrud.alliantinternet.com Received: from [64.197.110.172] ([64.197.110.172:36614] helo=thrud.alliantinternet.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id A4/C9-35770-84C788F4 for ; Fri, 13 Apr 2012 15:19:36 -0400 Received: by thrud.alliantinternet.com (Postfix, from userid 1001) id D9C16174321; Fri, 13 Apr 2012 15:19:31 -0400 (EDT) To: "'PHP Internals'" Date: Fri, 13 Apr 2012 15:19:28 -0400 Message-ID: <01ed01cd19aa$58810e80$09832b80$@alliantinternet.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Thread-Index: Ac0ZqlfvzsaDXekwRSSjaXrsePxUGA== Content-Language: en-us Subject: Ability to assign new object to a class property. From: dsnytkine@Ultralogistics.com ("Dmitri Snytkine") I always wondered why can't we do something like this in php class MyClass{ private $storage = new ArrayObject(); public function __construct($v){ // whatever } // rest of class } Why can't we create a new object and assign it to property like this? Then when a new instance of MyClass is created the $storage variable is automatically assigned a new ArrayObject. Somethink like this is valid, possible and commonly used in Java, why not in php? Has anyone already asked for this to be valid syntax in php? Dmitri Snytkine Web Developer Ultra Logistics, Inc. Phone: (888) 220-4640 x 2097 Fax: (888) 795-6642 E-Mail: dsnytkine@ultralogistics.com Web: www.ultralogistics.com "A Top 100 Logistics I.T. Provider in 2011"