A special function in class. Calls automatically when an object is created. __construct (two underscores) is fixed name for constructor. In PHP you can create only 1 constructor for each class.
class ConstructorDemo{
function __construct(){
echo "constructor called";
}
}
$cd = new ConstructorDemo();
Output:
constructor called
Constructor is used for default values, database connections, etc.