2012/4/13 Dmitri Snytkine <dsnytk...@ultralogistics.com>:
> 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: dsnytk...@ultralogistics.com
> Web: www.ultralogistics.com
>
> "A Top 100 Logistics I.T. Provider in 2011"
>
>
>
>
> --
> PHP Internals - PHP Runtime Development Mailing List
> To unsubscribe, visit: http://www.php.net/unsub.php
>

Hi, Dmitri

Just to add a random thought ....
When do you expect this code to be executed?

class Foo {
    static public $foo = new StdClass();
}

Sorry if this code contains syntax-errors, but I think you'll still
get the point ;)

Bye
Simon

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to