any major benefit in larger fread() blocks when reading STDIN?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



  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


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux