title: php://memory & php://temp; preserving stream data on subsequent handle creation
body: <p>This question is closely related to my new findings, regarding <a href="https://stackoverflow.com/questions/6910363/php-zip-open-and-php-temp-cant-seem-to-open">this question</a>.</p>
  
  <p>Is there any way to preserve the in stream data of <code>php://memory</code> or <code>php://temp</code> between handles? I read (<em>somewhere I can't source off hand</em>) that subsequent openings of the aforementioned streams clears existing data.</p>
  
  <pre><code>$mem1 = fopen('php://memory', 'r+');
  fwrite($mem1, 'hello world');
  rewind($mem1);
  fpassthru($mem1); // "hello world"
  
  $mem2 = fopen('php://memory', 'r+');
  rewind($mem2);
  fpassthru($mem2); // empty
  </code></pre>
  
  <p>So again my question is, is there anyway to force existing data to persist in stream when creating a new handle to it?</p>
  
  <p>(<em>The latter call to <code>fpassthru()</code> would of course dump <code>hello world</code> given this is possible</em>)</p>