NYCPHP Meetup

NYPHP.org

[nycphp-talk] determining empty STDIN | php://stdin (cli)

Analysis & Solutions danielc at analysisandsolutions.com
Tue Sep 23 11:46:37 EDT 2003


Hi Folks:

On Tue, Sep 23, 2003 at 10:07:04AM -0400, jon baer wrote:
> 
> <?php
>  stream_set_timeout(STDIN, 3);
>  $in = fgets(STDIN);
>  echo $in;
> ?>

I ran a similar test.  Do note though, the first parameter to the function 
is supposed to be a resource ID.  None the less, it returns false ("wasn't 
set" in my test) so this function isn't meant for manipulating STDIN.

        $In = fopen('php://stdin', 'r');
        if (stream_set_timeout($In, 1) ) {
            echo "was set\n";
        } else {
            echo "wasn't set\n";
        }

I just searched php.general about this and couldn't find any answers there 
either.  http://groups.google.com/groups?group=php.general

Enjoy,

--Dan

Ahhhh...  Snipping old posts makes me feel so good!

-- 
     FREE scripts that make web and database programming easier
           http://www.analysisandsolutions.com/software/
 T H E   A N A L Y S I S   A N D   S O L U T I O N S   C O M P A N Y
 4015 7th Ave #4AJ, Brooklyn NY    v: 718-854-0335   f: 718-854-0409



More information about the talk mailing list