I was looking for a way to interactively get a single
character response from user. Using STDIN with fread, fgets
and such will only work after pressing enter. So I came up
with this instead:
#!/usr/bin/php -q
<?php
function inKey($vals) {
$inKey = "";
While(!in_array($inKey,$vals)) {
$inKey = trim(`read -s -n1 valu;echo $valu`);
}
return $inKey;
}
function echoAT($Row,$Col,$prompt="") {
// Display prompt at specific screen coords
echo
" |