|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2010-01-30 16:56 UTC] nospam at mckenzies dot net
Description:
------------
The documentation for php://memory is incomplete. There is no example and there is no mention of what functions support the use of php://memory. Does it only work with streams?
Reproduce code:
---------------
$text = 'Some text.';
file_put_contents('php://memory', $text);
echo file_get_contents('php://memory');
Expected result:
----------------
Some text.
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Nov 20 03:00:01 2025 UTC |
Yes it only works for streams. You cannot store data in php://memory, and later use it in another stream: This will not work, because after file_put_contents() the stream will be closed and the data in php://memory will be lost: file_put_contents('php://memory', 'PHP'); echo file_get_contents('php://memory');