I am New to PHP and reading these day “PHP in Action” book
is good. But what i don’t understand is its Class Initiation syntax.
it uses often a syntax like
$config = new Config;
can someone please explain why he is instantiating like this, i mean without parentheses?
And is there are goog PHP book available to learn OOP with assignments?
PHPisn’t the only language that supports this. If the constructor takes no parameters, alsoC++allows the bypass of parentheses.Choose whichever you see around the code – i.e. if the company leaves out parentheses for default constructors, you should also leave them out, and vice-versa. Both are legal.