What's the difference between this two PHP object instantiation types?
I wonder about the differences of this PHP instantiation type.
$object = new MyClass();
vs
$this->object = new MyClass();
What's the difference between this two?
The first one instantiates an object of MyClass
to a variable object in variable-scope
.
The second one instantiates an object of MyClass
in another(not necessarily a different one) class object attributes value.
精彩评论