title: How to not call a function statically in php?
body: <p>I am using pear to send mail in PHP. I've followed the example that is on here (<a href="http://pear.php.net/manual/en/package.mail.mail.send.php" rel="nofollow noreferrer">http://pear.php.net/manual/en/package.mail.mail.send.php</a>). However, I am getting this error message. </p>
  
  <blockquote>
    <p><strong>Strict Standards:</strong> Non-static method Mail::factory() should not be called statically in C:\xampp\htdocs\functions.php on line 43</p>
  </blockquote>
  
  <p>So I've been trying to get this Strict Standards message to not show up.</p>
  
  <p>This is my code:</p>
  
  <pre><code>$smtpinfo["host"] = "********";
  $smtpinfo["port"] = "587"; 
  $smtpinfo["auth"] = true; 
  $smtpinfo["username"] = $mail_username; 
  $smtpinfo["password"] = $mail_password; 
  
  ## This line below is causing the problem ## 
  $mail =&amp; Mail::factory("smtp", $smtpinfo);  // &lt;-- Line 43
  </code></pre>
  
  <p>I've read many <a href="https://stackoverflow.com/questions/4044996/php-pear-mail-help?rq=1">Stack Overflow Q&amp;A</a> that say just add a <code>@</code> to the beginning of <code>$mail</code>. And it is true, it makes the error disappear, but I feel like that just hides the error, and doesn't actually solve the problem.</p>
  
  <pre><code>@$mail =&amp; Mail::factory("smtp", $smtpinfo); 
  </code></pre>
  
  <p><strong>How do I not call the method above as statically?</strong> </p>
  
  <p>Even the documentation on this page (<a href="http://pear.php.net/manual/en/package.mail.mail.send.php" rel="nofollow noreferrer">http://pear.php.net/manual/en/package.mail.mail.send.php</a>), says <code>This function cannot be called statically.</code>... but the example they gave is the same way I am calling the method?!</p>
  
  <p>Please don't answer just add <code>@</code> in front to remove the strict standard or <code>E_ALL &amp; ~E_STRICT</code> ... that is not a solution!</p>