Usually I create a new object invocating his constructor the usual way:
$instance= new Class();
Lately, I’m reading a lot of code with an alternative syntax (without the parentesys):
$instance= new Class;
There are substantial differences between the two methods or are they equivalent?
I haven’t found references on this topic ’till now.
There is no difference.
You’re right about this being hard to prove. The Basics introduces the
newkeyword but all examples have parentheses and no mention is made of their optionality.Edit: best I can find are examples from the official documentation such as: