title: preg_replace code evaluation with /e modifier
body: <p>I was looking for an alternative to eval() way to execute a code contained in a string variable, and noticed the <code>preg_replace</code> with the <code>/e</code> modifier.
  However, code is evaluated quite weirdly.</p>
  <p>For instance, <code>echo()</code> leads to an error in php 5.3.6:</p>
  <pre><code>&lt;?php
  $code = 'echo( \'Hello, world!\'.PHP_EOL)';
  preg_replace('/(.*)/e', $code, '' );
  ?&gt;
  </code></pre>
  <p>Error message:</p>
  <blockquote>
  <p>Parse error: syntax error, unexpected T_ECHO in /Users/.../test.php(4) : regexp code on line</p>
  <p>Fatal error: preg_replace(): Failed evaluating code: <br />echo( 'Hello, world!'.PHP_EOL) in /Users/.../test.php on line 4</p>
  </blockquote>
  <p>While <code>print()</code> works, and outputs a <em>Hello, world!</em>:</p>
  <pre><code>&lt;?php
  $code = 'print( \'Hello, world!\'.PHP_EOL)';
  preg_replace('/(.*)/e', $code, '' );
  ?&gt;
  </code></pre>
  <p>Also, it seems that out of several lines of code, only the first one is executed:</p>
  <pre><code>&lt;?php
  $t=1;
  $code = '$t++;$t++;';
  preg_replace('/(.*)/e', $code, '' );
  echo $t;
  ?&gt;
  </code></pre>
  <p>Outputs <em>2</em>, not <em>3</em>.</p>
  <p><strong>Question</strong>: is this code evaluation within PCRE in <code>preg_replace()</code> documented somewhere?
  Not found on php.net</p>