I inherited a php project that was previously assigned to another development company and I often see very strange code implementations which I've never seen before and which I think are probably errors. That said, they are everywhere and the server logs don't complain about them or cast warnings. It's possible that error_reporting
has been turned off somewhere.
For example, I am seeing a lot of class declarations like this:
$registration = new EventRegistration;
That's strange to me, as I've only ever seen class instancing using new
done as:
$registration = new EventRegistration();
Can someone clarify if this is incorrect / not best practice / passable?
I assume it's just a syntax error that will compile but is technically wrong. Something similar to when people do array syntax like $array[key]
instead of $array['key']
. Is that correct?
Thanks.