Prev: Inconsistent json_decode() results
Next: Using array_intersect with an unknown number of arrays
From: "Robert P. J. Day" on 6 May 2010 12:05 i'm looking at some existing code that (obviously) reads from stdin: $fd = fopen("php://stdin", "r"); $source = ""; while (!feof($fd)) { $source .= fread($fd, 1024); } fclose($fd); it works fine, but is there any reason the original author would have chosen 1024 as the individual read unit size? from the PHP page for fread here: http://ca.php.net/manual/en/function.fread.php i read that reading with fread() stops after (among other things), "8192 bytes have been read (after opening userspace stream)." does that mean that 8192 is the maximum read size you can specify? and would there be any drawback or value in changing 1024 to 8192? or would it make so little difference that it doesn't matter? thanks. rday
|
Pages: 1 Prev: Inconsistent json_decode() results Next: Using array_intersect with an unknown number of arrays |