PHP uses __construct() to set properties for a newly created object. From what I understand, it’s not really a constructor, but a method. Why?
Also – for less .. inconsistent languages like Java or Python does the object gets instantiated before or after the constructor is called? And how is this different from the PHP way?
Thanks!
Both of those languages instantiate it before calling the constructor. In Java, you have access to
this, in Pythonself. Also, in Java, it’s like a method, except with no return type. In Python, the syntax is exactly that of a method (__init__).