Thanks for the quick reply. I did try that before, but now my issue is
that the if-else section does not recognize the data as being valid. So,
I changed it to fgets(), and reran, this time using valid data. The
initial problem is corrected (it only gives the error once), but now it
does not recognize my data, and I get the error once no matter what I
input. Is there anything in particular I would need to do to the
variable, after the STDIN, to prepare it for the validation?

Jesse Hazen
-----Original Message-----
From: Robert Cummings [] 
Sent: Wednesday, March 18, 2009 7:00 AM
To: Hazen, Jesse, arvato digital services llc
Subject: Re: [PHP] PHP-CLI issue

On Wed, 2009-03-18 at 06:52 -0700, wrote:
> private function getSelection() {
>                         fwrite(STDOUT,"Mode: ");
>                         $input = strtoupper(fgetc(STDIN));   
>                         return $input;
>             }

Use fgets() instead of fgetc(). You're retrieving one character at a
time. When someone hits enter... 1 (or in winblows 2) extra characters
are usually put on the input stack that represent the enter key itself.

Application and Templating Framework for PHP

PHP General Mailing List (
To unsubscribe, visit:

Reply via email to