Hi Larry, In this case, if the `with` happens first, then the new address object is > cloned needlessly, but that *probably* doesn't hurt anything. But $newAddr > !== $p3->address. >
Yes, I agree with this: "clone $this with ["x" => "y"];" is the easiest to mentally model as a shorthand for "$self = clone $this; $self->x = "y";". If we agree with this model, then it would be weird to execute __clone() at the end indeed. But I think Nicolas' example explained this fact much better than I could. :) Also, separating __clone() from the rest of the clone opcode would be . And you are right, some objects may be cloned unnecessarily, which doesn't hurt, but isn't ideal for sure. I should mention that in ideal circumstances (when all properties are readonly + all of them are initialized during construction + none of them are mutable internally), deep cloning is not 100% required, unless only for defensive programming purposes. Regards, Máté