title: PHP Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP
body: <p>I'm developing an application in CodeIgniter, and I'm getting an error in sending mail while registering.</p>
  <blockquote>
  <p>PHP Deprecated:  Methods with the same name as their class will not be
  constructors in a future version of PHP; emailcomm has a deprecated
  constructor in
  /var/www/html/portal/application/libraries/emailcomm.php on line 3</p>
  </blockquote>
  <p>My Library file is below
  <strong>emailcomm.php</strong></p>
  <pre><code>class emailcomm
  {
       
      var $to;
      var $subject;
      var $message;
      var $from='From:';    
      
      function emailcomm()
      {
          $this-&gt;CI=&amp;get_instance();   
          ini_set(&quot;SMTP&quot;,&quot;ssl://smtp.gmail.com&quot;);
              ini_set(&quot;smtp_port&quot;,&quot;465&quot;);
  
              $config['protocol'] = 'smtp';
              $config['smtp_host'] = 'smtp.gmail.com';
              $config['smtp_port'] = '465';
              $config['_smtp_auth']=TRUE;
              $config['smtp_user'] = 'contact-us@webtech.com';
              $config['smtp_pass'] = 'Web8*98*2015'; 
              $config['smtp_timeout'] = '60';
              $config['charset'] = 'utf-8';
              $config['wordwrap'] = TRUE;
              $config['mailtype'] = &quot;html&quot;;
          
          $this-&gt;CI-&gt;load-&gt;library('email',$config); 
          
           $this-&gt;CI-&gt;email-&gt;initialize($config); 
      }
  }
  </code></pre>
  <p>Recently upgraded the server to php7, and now my code doesn't work anymore. I'm going through the error logs showing the above error. How can I fix my code?</p>