title: Fatal error: Uncaught Error: Call to undefined function - have to use $this
body: <p>Here is my code:</p>
  
  <pre><code>&lt;?php
  
  public function __construct() {
      getUsername();
  }
  
  public function getUsername() {
      //blah blah blah
  
      return "bobby";
  }
  
  ?&gt;
  </code></pre>
  
  <p>It does not work and it says this error:</p>
  
  <blockquote>
    <p>Fatal error: Uncaught Error: Call to undefined function...</p>
  </blockquote>
  
  <p>but if I call the function in my constructor like this: <code>$this-&gt;getUsername();</code> it works. Why is that the case?</p>