class a {
}
$obj1 = new a();
$obj2 = new a();
$obj3 = new a();
May be very trite, but… how many object creates this code?
I think, may be this code greates only 1 object in this line $obj1 = new a(); and $obj2 and $obj3 just indicate on an already created object?
I am wrong?
The code will create three distinct objects, and each variable will reference a different one.
newalways constructs a new object instance.