title: PHP: calling require_once in constructor function
body: <p><code>require_once</code> in constructor function, is not working I also tried include and require. <code>file_exists</code> function is working fine.</p>
  
  <p>Here is my code:</p>
  
  <pre><code>&lt;?php
  
  class App {
  
      protected $controller = 'home';
      protected $method = 'index';
      protected $params = [];
  
      public function __construct() {
          $url = $this-&gt;parseUrl();
          //print_r($url);
  
          if(file_exists(__DIR__.'/../controllers/'. $url[0] . '.php')) {
              $this-&gt;controller = $url[0];
              unset($url[0]);
          }
  
          require_once(__DIR__.'/../controllers/Home.php');
          echo $this-&gt;controller;
  
      }
  }
  </code></pre>