Created
November 24, 2015 15:03
-
-
Save vitqst/77f8ec0bff8b5a2a3728 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| class Model{ | |
| public $string; | |
| public function __construct(){ | |
| $this->string = "Hello world" ; | |
| } | |
| } | |
| class View{ | |
| private $model ; | |
| private $controller ; | |
| public function __construct($controller, $model){ | |
| $this->model = $model ; | |
| $this->controller = $controller ; | |
| } | |
| public function output(){ | |
| return "<p>" . $this->model->string . "</p>"; | |
| } | |
| } | |
| class Controller{ | |
| private $model ; | |
| public function __construct($model){ | |
| $this->model = $model ; | |
| } | |
| } | |
| $model = new Model(); | |
| $controller = new Controller($model); | |
| $view = new View($controller, $model); | |
| echo $view->output(); | |
| ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment