Hello.
When creating an object out of a class, must I use parenthesis or not?
This?
$obj = new RandomClass();
Or this?
$obj = new RandomClass;
Both seem to work just fine, but I would just like to know which one is “standard”.
Thank you.
Hello.
When creating an object out of a class, must I use parenthesis or not?
This?
$obj = new RandomClass();
Or this?
$obj = new RandomClass;
Both seem to work just fine, but I would just like to know which one is “standard”.
Thank you.
Never-mind.
As far as I know there is no such specified standard but I would prefer/recommend to use with parenthesis to make always one standard. Because you have to use parenthesis when there are any arguments in the constructor and to make consistent coding it is better to use always parenthesis.