class SampleClass{
public $objproperty = new AnotherClass();
public function __construct(){
// Codes...
}
}
The code looks simple, but I am guessing the idea is here. You can instantiate your property as an object of a specific type upon declaration. It seems that in PHP 5.3 this will generate an error message, does PHP 5.4 support property declaration as object now? If not, has there been proposals to add this feature in next major PHP release?