To read a single key-press in CLI mode, you can either use ncurses (which will probably require additional modules for PHP) or get nasty with the *nix "/bin/stty" command)
<?php
function stty($options) {
exec($cmd = "/bin/stty $options", $output, $el);
$el AND die("exec($cmd) failed");
return implode(" ", $output);
}
function getchar($echo = false) {
$echo = $echo ? "" : "-echo";
$stty_settings = preg_replace("#.*; ?#s", "", stty("--all"));
stty("cbreak $echo");
printf("> ");
do {
printf("%02x ", ord($c = fgetc(STDIN)));
} while ($c != '.');
stty($stty_settings);
}
getchar();
?>