Pergunta de entrevista da empresa First Due

What are the different ways to call a constructor in PHP?

Resposta da entrevista

Sigiloso

20 de dez. de 2023

$o = new SomeClass(); OR Or define a static method inside a class(say getInstance) and do "return new static" in this static method. Finally call this method like, className::getInstance(); from outside the class.