title: How to load a class inside the function in PHP?
body: <p>I have a class already load inside <code>__construct()</code> of my page, after that once again I want to load this class, inside another function. Here is my code.</p>
  
  <pre><code>&lt;?php
  
  class MainClass {
    public $config;
  
    public function __construct($config) {
      $this-&gt;config = $config;
    }
  
    public function routes() {
      // here I need to load the config class
    }
  }
  ?&gt;
  </code></pre>
  
  <p>inside routes function i want to call an array form config class file</p>