PHP program to implement the default or no-argument constructor using __construct()

bookmark

<?php  
    //PHP program to implement the default or no argument 
    //constructor using __contruct().
    class Sample
    {  
        public function __construct()
        {  
            echo "Default constructor called<br>";  
        }  
        public function  Method1()
        {  
            echo "Method1 called<br>";  
        }  
    }  
    $S = new Sample();  
    $S->Method1();
?>  


Output
Default constructor called
Method1 called