Voting

: max(nine, five)?
(Example: nine)

The Note You're Voting On

ktraas at gmail dot com (Kevin Traas)
16 years ago
I was using command-line PHP to create an interactive script and wanted the user to enter just one character of input - in response a Yes/No question. Had some trouble finding a way to do so using fgets(), fgetc(), various suggestions using readline(), popen(), etc. Came up with the following that works quite nicely:

$ans = strtolower( trim( `bash -c "read -n 1 -t 10 ANS ; echo \\\$ANS"` ) );

<< Back to user notes page

To Top