title: Can I load a file in PHP as a string with inline variables?
body: <p>I've got a simple (but not tiny) template for some HTML, complete with inline variables. I'd like to pull that out as a separate file, and have the ability to switch in other template files. Is there a way to load a file into a string, but have it process inline variables?</p>
  
  <p>Eg:</p>
  
  <pre><code>$thing="complete sentence";
  $test=&lt;&lt;&lt;END
      This will get parsed as a $thing.
  END;
  echo $test; // This will get parsed as a complete sentence.
  </code></pre>
  
  <p>What I want is something like this:</p>
  
  <pre><code>// "test.html"
  &lt;html&gt;
  &lt;body&gt;
      &lt;p&gt;This will get parsed as a $thing.&lt;/p&gt;
  &lt;/body&gt;
  
  // "index.php"
  $thing="complete sentence";
  $test=file_get_contents("test.html");
  echo $test; // This will get parsed as a complete sentence.
  </code></pre>
  
  <p>How do I achieve this, preferably without a templating library?</p>