A PHP class can have more than one constructor.

  • No
  • Yes
  • Depends on the PHP version
  • Only if the class is abstract
In PHP, a class cannot have more than one constructor. The correct option is "No." Unlike some other programming languages, PHP does not support multiple constructors within a single class. However, you can achieve similar functionality by using optional parameters or method overloading. For further details, refer to the PHP documentation on constructors: http://php.net/manual/en/language.oop5.decon.php
Add your answer
Loading...

Leave a comment

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