create class directly after a property field?

Posted by fayer on Stack Overflow See other posts from Stack Overflow or by fayer
Published on 2010-04-27T03:40:02Z Indexed on 2010/04/27 3:43 UTC
Read the original article Hit count: 172

Filed under:
|

in java you can create an object directly after the property field like this:

but it seems not working for php:

class Test {
    public $object = new Object();
}

you have to create it in the __construct() and assign it to the property?

thanks

© Stack Overflow or respective owner

Related posts about php

Related posts about oop