Pregunta de entrevista de First Due

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

Respuesta de la entrevista

Anónimo

20 dic 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.