Set the length argument fread() to a higher value (i.e. 1024, 2048, 10000) - it determines the length max of the data read by fread() . If you only need up to 80 characters, then check that after reading and shortening, use substr() when necessary. You do not need to open the input stream if you use STDIN ( docs ), which is recommended due to errors when processing php://stdin before PHP 5.2.1 ( docs ).
$input = ""; while($input == "") { echo "Please enter : "; $input = fread(STDIN, 10000); }
Also note that STDIN , STDOUT , STDERR already defined system constants. You should not use these names for your own constants.
source share