Instantiate a class with or without parentheses? [duplicate]

Possible Duplicate:
PHP class instantiation. To use or not to use the parentheses?

I have not found any official documentation on this. But afaik it doesn't matter whether a class is instantiated with our without the parentheses - as long as there are no parameters involved, right?

$car = new Car;

or

$car = new Car();

But can anyone tell me if there's a difference in performance? Which way is the 'more correct' way? Is there any official documentation for this?


Solution 1:

Any difference in performance is going to be absolutely negligible.

While both ways are fine, I personally would prefer using new Car(); because usually, a method is being called here, and function/method calls in PHP require (). Also, it's more consistent with instantiations that have parameters.

But in the end, it's down to taste. It doesn't matter which way you choose, but when you choose one, stick to it consistently!

Solution 2:

the first instantiation has no "official" reference. In the official php doc you alway find the second one. So, i'de prefere this for consistenscy. But it's all your choice

Solution 3:

They're both correct ways, and I'm sure there isn't any difference in performance either.