First, the construction method:
The constructor method is the first method that is automatically called by the object after the object is created, so it is common to use construction methods to perform initialization of some objects.
The construction method in PHP cannot be overloaded for the following reasons:
1, the name of the construction method is fixed, in PHP can not declare the same name of two functions;
However, you can implement the ability to construct method overloads in other object-oriented programming languages by using default parameters when declaring construction methods.
Second, the Destruction method
A destructor is the last method that an object is automatically called by an object before it is destroyed, so a destructor is often used to complete cleanup of objects before they are destroyed.
Case where the object was destroyed:
1. When the object in the heap memory loses access to its reference, such as the reference is given a null value;
2, the page runs the end, the object loses the application.
Construction method and destructor method in PHP