title: Displaying messages to users through class
body: <p>I'm having a problem with displaying errors on my login form.</p>
  
  <p>My class is called "Class.auth.php" and the login works fine as does the function to direct users back if they are not logged in.</p>
  
  <p>In my Auth Class file I have:</p>
  
  <pre><code>public $feedback_negatives = array();
  </code></pre>
  
  <p>And then later on I have the following, for if the login fails:</p>
  
  <pre><code>$this-&gt;feedback_negatives[] = "Login failed.";
  </code></pre>
  
  <p>This is then shown on the page by:</p>
  
  <pre><code>if (isset($auth)) {
  
      if ($auth-&gt;feedback_negatives) {
              foreach ($auth-&gt;feedback_negatives as $feedback_negative){
                      echo $feedback_negative;
                  }
          }
  }
  </code></pre>
  
  <p>This however doesn't seem to work. I have no idea what I'm doing wrong. I was previously using $_SESSION to store error messages (as quite a few answers here recommended) but this seems cleaner. Any help is appreciated.</p>