Is it OK to call function from constructor?

No, it’s not good practice . The constructor is a “magic” method which doesn’t return anything and it should never be called manually. PHP calls this when the new constructor or the inspector functions for creating objects are called.

Leave a Reply

Your email address will not be published. Required fields are marked *