Skip to content

Instantly share code, notes, and snippets.

@vitqst
Created November 24, 2015 15:03
Show Gist options
  • Select an option

  • Save vitqst/77f8ec0bff8b5a2a3728 to your computer and use it in GitHub Desktop.

Select an option

Save vitqst/77f8ec0bff8b5a2a3728 to your computer and use it in GitHub Desktop.
<?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