$10K coding deathmatch

Chris Carey chris.carey at gmail.com
Wed Nov 1 16:49:45 MST 2006


On 11/1/06, Stephen Weeks <tene at iodynamics.com> wrote:
> Chris Carey wrote:
>
> > if(!defined("STDIN")) define("STDIN", fopen('php://stdin','r'));
> > $input = split("\n", fread(STDIN, 8192)); // PHP has a limit of 8192
> > bytes on fread :(
>
> Not all PHP installs have a STDIN file descriptor defined?
>

Dunno. In true php fashion, I stole that code from some code snippet
on the Internet without actually reading the language spec.

$input = split("\n", fread(fopen('php://stdin','r'), 8192));

...accomplishes the same thing.



More information about the PLUG mailing list