Fairly straightforward question. In C++ the parent constructor will be implicitly called before the child constructor, so what logic is there for PHP not to do things this way?
EDIT: I’ve got a good answer from Lukman, but I was hoping for more of a reason why there is a difference. Maybe the question should be why does C++ not allow custom calling of parent constructors? I guess that’s another question though.
I think it’s a good thing that PHP makes you call parent’s constructor manually, because it allows child’s constructor such as following:
Or even:
Meaning, you are free to call the parent constructor anywhere within the child’s and you are free to do stuff before and after the call. Ain’t that a feature indeed?