0

I have seen in many websites showing examples of instantiating objects.

$obj = new foo;

which is straight forward, but I have also seen this:

$obj = new foo();

is there a difference? So far I noticed both do the same.

S.H.
  • 2,833
  • 3
  • 26
  • 28

1 Answers1

3

There is no difference, it is a matter of opinion. If foo had a constructor with parameters you would need to use new foo($param);

SamV
  • 7,548
  • 4
  • 39
  • 50