RE: [PHP-DEV] Ability to assign new object to a class property.
| From: | Dmitri Snytkine | Date: | Sat, 14 Apr 2012 12:03:07 +0000 |
| Subject: | RE: [PHP-DEV] Ability to assign new object to a class property. | ||
| References: | 1 2 3 4 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-59925@lists.php.net to get a copy of this message | ||
Why not?
It's convenient to assign an empty array to a property in this manner.
private $storage = array();
So why not
private $storage = new ArrayObject();
Doing stuff like this in class definition vs in constructor just makes code
look cleaner.
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"
-----Original Message-----
From: Stas Malyshev [mailto:smalyshev@sugarcrm.com]
Sent: Friday, April 13, 2012 8:08 PM
To: Anthony Ferrara
Cc: Dmitri Snytkine; PHP Internals
Subject: Re: [PHP-DEV] Ability to assign new object to a class property.
Hi!
> Just throwing this out there, but that code wouldn't be run on parse.
> It would be "queued" to run prior to the constructor on instantiation.
Why? You have perfectly good ctor, why not use it?
--
Stanislav Malyshev, Software Architect
SugarCRM: http://www.sugarcrm.com/
(408)454-6900 ext. 227