Created
September 24, 2020 03:46
-
-
Save jamesBan/7284a341a054826421435c9a750f49b4 to your computer and use it in GitHub Desktop.
string to stream
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$string = "I tried, honestly!"; | |
$stream = fopen('data://text/plain,' . $string,'r'); | |
echo stream_get_contents($stream); | |
$string = 'Some bad-ass string'; | |
$stream = fopen('php://memory','r+'); | |
fwrite($stream, $string); | |
rewind($stream); | |
echo stream_get_contents($stream); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment