Re: Proposal: php://memory/<id> (& ://temp/<id>)
| From: | Sebastian Krebs | Date: | Thu, 31 Jan 2013 11:00:07 +0000 |
| Subject: | Re: Proposal: php://memory/<id> (& ://temp/<id>) | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-65533@lists.php.net to get a copy of this message | ||
2013/1/31 Chris Wright <chrisw@aquacool.ltd.uk>
> > I propose the following syntax:
> >
> > php://memory/<id>
> > php://temp/<id>/maxmemory:<size>
>
> I would very much like to see this as well.
>
> Would this also allow you to open multiple pointers to the same bucket?
>
> For example would this work?
>
> <?php
>
> $fp = fopen('php://memory/foo', 'w+');
>
> file_put_contents('php://memory/foo', 'data');
>
> rewind($fp); // would this be necessary?
>
> echo stream_get_contents($fp); // outputs 'data'
>
Everything else wouldn't make much sense, because why else should you need
to define an id for it?
Bu whats about
file_put_contents('php://memory/foo', 'data');
$fp = fopen('php://memory/foo', 'w+');
'file_put_contents()' closes the stream after writing. I would expect, that
the engine will cleanup the memory (at least sooner or later), but then I
open it again.
Additional why don't you just pass the open stream around, if you need to
access it at multiple places?
Regards,
Sebastian
>
> Best regards
> Chris Wright
>
> --
> PHP Internals - PHP Runtime Development Mailing List
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--
github.com/KingCrunch