In PHP, you can define a constructor in a class using the __construct() keyword.

  • keyword
  • function
  • method
  • property
In PHP, you can define a constructor in a class by using the __construct() keyword. The correct option is "keyword." The __construct() method is a special method that is automatically called when an object of the class is created. It is used to initialize the object's properties or perform any necessary setup tasks. 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 *