| 
|  |  |    | 9³â Àü |  | 
| // Set the limit to 5 MB. $fiveMBs = 5 * 1024 * 1024;
 $fp = fopen("php://temp/maxmemory:$fiveMBs", 'r+');
 
 fputs($fp, "hello\n");
 
 // Read what we have written.
 rewind($fp);
 
 echo stream_get_contents($fp);
 
 //string to memory read
 $temp_string = "hello php memory";
 $handle = fopen("php://memory","w");
 
 fwrite($handle, '<br><br><br><br>');
 fwrite($handle, 'first<br>');
 fwrite($handle, 'second<br>');
 fwrite($handle, 'last : '.$temp_string.'<br>');
 rewind($handle);
 
 if ($handle) {
 while (($buffer = fgets($handle, 4096)) !== false) {
 echo $buffer;
 }
 if (!feof($handle)) {
 echo "Error: unexpected fgets() fail\n";
 }
 fclose($handle);
 }
 | 
 |  
|  ̵̧ : 436 | ̵̧
¸ñ·Ï |  |