Re: Proposal: php://memory/<id> (& ://temp/<id>)

From: Date: Thu, 31 Jan 2013 11:18:58 +0000
Subject: Re: Proposal: php://memory/<id> (& ://temp/<id>)
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-65537@lists.php.net to get a copy of this message
On Thu, 31 Jan 2013 10:37:53 +0100, Ivan Enderlin @ Hoa <ivan.enderlin@hoa-project.net> wrote:
The php://memory, and its respectful sibling php://temp, appear very useful when we need to compute streams on-the-fly. They offer a lot of services, like avoiding HDD accesses, increasing speed... and through a straightforward API /à la/ PHP, e.g. fopen('php://memory', 'r+'). However, we always work on the same "bucket"/space of data (per runtime), which prevent us to use two different streams at a time. My proposal is to allow access to many "buckets"/spaces to php://memory and its sibling.
I'm not sure what you mean here. Each time you open a php://memory stream, you're working on a new "bucket", right? $ cat a.php && php a.php <?php $f1 = fopen("php://memory", "r+"); $f2 = fopen("php://memory", "r+"); fwrite($f1, "foobar"); array_map(function($f) { rewind($f); var_dump(stream_get_contents($f)); }, [$f1, $f2]); string(6) "foobar" string(0) "" -- Gustavo Lopes

« previous php.internals (#65537) next »