title: Render a PHP File Via a Another PHP File
body: <p>I want to render a php file through another php file. </p>
  
  <p>I have two php files. One defines a class. Another one holds both html and php. For the sake of better understanding, I am providing a demo code.</p>
  
  <p><code>file1.php</code></p>
  
  <pre><code>&lt;?php
  
  class someClass
  {
      public function someMethod()
      {
         echo readfile('file2.php');
      }
  }
  </code></pre>
  
  <p><code>file2.php</code></p>
  
  <pre><code>&lt;?php
      $block = 'block';
      echo $block;
  ?&gt;
  &lt;div&gt;djkdjkjkjfkjkdjfkjk&lt;/div&gt;
  </code></pre>
  
  <p><code>index.php</code></p>
  
  <pre><code>&lt;?php
  require_once 'file1.php'
  $class =  new someClass();
  $class-&gt;someMethod();
  </code></pre>
  
  <p>When I load <code>www.domain.com</code>, Output is as follows</p>
  
  <pre>djkdjkjkjfkjkdjfkjk
  71</pre>
  
  <p>That is my method is not parsing php codes correctly. How can I echo content of <code>file2.php</code> in normal way (as we just see the output for <code>www.domain.com/file2.php</code>)?</p>