Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /*
- * CONTROLLER
- */
- class Controller
- {
- //OBJECTS
- private $model;
- private $view;
- //DATA
- private $string;
- private $length;
- function __construct()
- {
- $this->startModel();
- $this->getString();
- $this->getLength();
- $this->echoLength();
- }
- function startModel()
- {
- require_once '/../model/model.php';
- $this->model = new Model();
- }
- function getString()
- {
- $this->string = $_POST['string'];
- }
- function getLength()
- {
- $this->length = $this->model->returnLength($this->string);
- }
- function echoLength()
- {
- require_once '/../view/view.php';
- $this->view = new View($this->length);
- }
- } // ./CONTROLLER
- /*
- * MODEL
- */
- class Model
- {
- public function returnLength($string)
- {
- return strlen($string);
- }
- } // ./MODEL
- /*
- * VIEW
- */
- class View
- {
- function __construct($strlen)
- {
- echo $strlen;
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment