Re: PHP-CLI issue

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

 



On Wed, 2009-03-18 at 06:52 -0700, Jesse.Hazen@xxxxxxxxxxxxx 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


-- 
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