2. OOP- Constructors & Destructor

If you create a __construct() function (it is your choice,) PHP will automatically
call the __construct() method/function when you create an object from your class.

The ‘construct’ method starts with two underscores (__) and the word ‘construct’. You ‘feed’ the constructor method by providing a list of arguments (like a function) after the class name.

constructor

constructor-value-send

destructor

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s