I have a class already load inside __construct() of my page, after that once again I want to load this class, inside another function. Here is my code.
<?php
class MainClass {
public $config;
public function __construct($config) {
$this->config = $config;
}
public function routes() {
// here I need to load the config class
}
}
?>
inside routes function i want to call an array form config class file
Your
$configis already loaded as a property of the object, since you passed it in the constructor. If you need to access the$configfrom another member function, just use$this->config->whatever