Find the best answer to your question, help others answer theirs

If you are going to use a passage of Lorem Ipsum, you need to be sure there
isn't anything embarrassing hidden in the middle of text.

  • Anybody can ask a question
  • Anybody can answer
  • The best answers are voted up and rise to the top
What is Constructor?
Asked 8 वर्ष पहले
Viewed 687 times

1 Answer

2
A constructor is a special kind of a method. It is automatically called when the object is created. The purpose of the constructor is to initiate the state of the object. The name of the constructor in PHP is __construct() (with double underscores).

There are 3 type of constructor in php -
  • Default - __construct() is not declared, then uses default. By default it is non-Parameterized.
  • Parameterized - __construct() is declared with parameter:
  • Copy - __clone(). it is used to create copy one.
Edit
avatar
Majed Badawi
15.5k 3 10 26
answered 8 hours ago

Leave a Comment

[named hyperlinks] (https://example.com)
**bold**
_italic_

Your Answer

Drop files here or click to upload.