Reputation: 1
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?
Upvotes: 0
Views: 105
Reputation: 20859
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.
Upvotes: 1