No, PHP does not allow you to do this. the only way to assign an object to a class property is through class methods.
if you want an empty class to be assigned to a class property when initializing the object, you can use this constructor method.
class xxx { public $array = array(); public $object1; public function __construct() { $this->object1 = new stdClass(); } }
source share