title: Call a class within other class (call_user_func)
body: <p>I'm trying to create a MVC Framework for studying purposes.</p>
  
  <p>So, I'm trying to call the right class and action by reading URL. But, I'm getting troubles with <code>call_user_func</code> function.</p>
  
  <p>I have already read URL, and set controller and action names, but I can't call it. When I run <code>call_user_func</code> function I get the following error: <code>Fatal error:  Class 'PageController' not found in...</code></p>
  
  <p>Obviously the class is not loaded, and that's my question. How can I make it callable here?
  I have a namespace for it, but I don't know if it is useful for something.</p>
  
  <p>Here's the code</p>
  
  <pre><code>namespace Core\Dispatcher;
  
  use Core\Routing\Router;
  
  class Dispatch {
  
      private $params = [];
  
      public function dispatch()
      {
          $this-&gt;getParams();
  
          /*error occurs here*/ call_user_func(new $this-&gt;params['Controller'], $this-&gt;params['Action']);
      }
  
      private function getParams()
      {
          $this-&gt;params = Router::read();
      }
  }
  /*
   * Router::read reads url and return an array with Controller and Action names
   */
  </code></pre>
  
  <p>Yes, the whole thing is based on CakePHP Framework, but only class names, folders, etc.</p>
  
  <p>So, any idea? I'm forgetting information?</p>
  
  <p>Thank you</p>
  
  <p><strong>Edit</strong>
  Here's a link to my repo on Bitbucket. I think it's enable download.
  <a href="https://bitbucket.org/cecavi/framework.git" rel="nofollow">Bitbucket</a></p>