title: PHP MVC - How to get value of variable in include or require file
body: <p>I'm learning and writting MVC by php. I set value of variable from file controller and i want to get value in file views but it's not working. 
  My controller:</p>
  
  <pre><code>class BooksController extends Controller
      {
          function list()
          {
              $books = $this-&gt;model-&gt;get_all(); 
              render('view/book/list');
          }
      }
  </code></pre>
  
  <p>My views list.php:</p>
  
  <pre><code> &lt;?php
    var_dump($books);
  ?&gt;
  </code></pre>
  
  <p>My function render:</p>
  
  <pre><code>function render($file_name,$extent="php"){
          $file_name = 'view/'.$file_name.'.'.$extent;
          if(!file_exists($file_name))
              throw new Exception("Can't open file ".$file_name);
          require_once $file_name; 
      }
  </code></pre>
  
  <p>Result: NULL</p>
  
  <p>I trying replace:</p>
  
  <pre><code>render('view/book/list');//not work
  </code></pre>
  
  <p>to </p>
  
  <pre><code>require_once('view/book/list.php');//work
  </code></pre>
  
  <p>Pls tell me, What is wrong?</p>