title: how blade can access to defined varibles outside of itself
body: <p>i want to create a template engine with php regex</p>
  
  <p>my template engine is the following code</p>
  
  <pre><code>&lt;?php
  
      class tmp
      {
          public function assign($name,$val){
              $GLOBALS[$name]=$val;
          }
          public function compile($buffer){
              $buffer= '?&gt; '.preg_replace('~\{\!\!\s*\$(\w+)\s*\!\!\}~', '&lt;?php echo $GLOBALS["$1"]; ?&gt;', $buffer);
  
              file_put_contents('compiled.php', $buffer);
              return $buffer;
          }
          public function run($run){
              return eval($run);
          }
      }
  
  ?&gt;
  </code></pre>
  
  <p>and my theme is the following code</p>
  
  <pre><code>{!! $bar !!} 
  </code></pre>
  
  <p>and compiled theme is</p>
  
  <pre><code> ?&gt; 
      &lt;?php echo $GLOBALS["bar"]; ?&gt; 
  </code></pre>
  
  <p>I access to vars with $GLOBALS 
  but in blade the compiled code is as follows</p>
  
  <pre><code>&lt;?php echo $bar; ?&gt;
  </code></pre>
  
  <p>how blade can access to defined vars directly with their name?</p>