__construct and __destruct function in oop php. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 6

__construct and __destruct function in oop php.

explain the use of __construct and __destruct function in oop php with example.

17th Aug 2018, 5:07 AM
Raj Shekhar
Raj Shekhar - avatar
3 Answers
+ 17
Here's an explanation with examples. http://php.net/manual/en/language.oop5.decon.php
17th Aug 2018, 6:42 AM
Igor Makarsky
Igor Makarsky - avatar
+ 1
In my opinion __construct is called when you have created a new object and __destruct is called when the object is no longer needed and needed to be disposed of.
18th Aug 2018, 11:15 AM
Jin Vincent Necesario
Jin Vincent Necesario - avatar
0
go for tutorials point
17th Aug 2018, 8:08 PM
Ahsan