Re: PHP-CLI issue
| From: | Robert Cummings | Date: | Wed, 18 Mar 2009 14:00:23 +0000 |
| Subject: | Re: PHP-CLI issue | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-290231@lists.php.net to get a copy of this message | ||
On Wed, 2009-03-18 at 06:52 -0700, Jesse.Hazen@arvatousa.com 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.
Cheers,
Rob.
--
http://www.interjinn.com
Application and Templating Framework for PHP