I'm experimenting with MVC trying to make a simple framework. This is an example of what I'm doing:
<?php
require_once('config.php'); //Here I have the Config object
class App{
protected $config;
protected $controller;
public function init(){
$this->config = new Config;
$this->controller = new Main_Controller;
}
}
class Main_Controller extends App{
public function __construct(){
var_dump($this->config);
}
}
$app = new App;
$app->init();
The problem is that my var_dump is returning NULL, so why isn't Main_Controller reading that App property?