title: How to call function from another class file in php
body: <p>I have a Response.php file which has a function inside and i want to call the function to another .php file.</p>
  
  <p>here's the Response.php</p>
  
  <pre><code>&lt;?php
  include 'connection.php';
  $response = array();
  class Response_Function{
   public function fieldMissing() {
      $response["success"] = 0;
      $response["message"] = "Required field(s) is missing";
      $response = json_encode($response);
  
      echo $response;
      }
  }
  
  ?&gt;
  </code></pre>
  
  <p>and this is the file calling the <code>fieldMissing()</code> function </p>
  
  <pre><code>&lt;?php
  include 'connection';
  require_once 'include/Response.php';
  $db = new Response_Function();
  $response = $db-&gt;fieldMissing();
  echo $response;
  ?&gt;
  </code></pre>