title: PHP: Calling a user-defined function inside constructor?
body: <p>I have a class <code>userAuth</code> inside its constructor I have added code to check the user is valid or not, if there is no value in session then I check cookies (as a part of "Remember Me" feature), if there is some value inside cookies then I call a function <code>ConfirmUser</code> to check its authenticity from database. On the basis of value returned by the confirmUser function I am returning a bool (true or fales) value in constructor.</p>
  
  <p>I have created my class as:</p>
  
  <pre><code>&lt;?php
      class userAuth {
  
          function userAuth(){
              //code
          }
  
          function confirmUser($username, $password){
                     //code
          }
      }
  
      $signin_user = new userAuth();
  
  ?&gt;
  </code></pre>
  
  <p><code>confirmUser</code> function take two string type parameters and return return a integer value of 0, 1, 2.</p>
  
  <p>I can't add code of <code>confirmUser</code> function inside the constructor as I am using this function at some more places in my application.</p>
  
  <p>So, I want to know how to call a user-defined function inside constructor in PHP. Please help.</p>
  
  <p>Thanks!</p>