While function ncurses_nodelay() is still not implemented and if you need a non-blocking getch,
following code might help.
<?php
$init = ncurses_init();
$full = ncurses_newwin (0,0,0,0);
ncurses_wborder($full,0,0,0,0,0,0,0,0);
ncurses_wrefresh($full);
$running = true;
$fp = fopen("php://stdin","r"); stream_set_blocking($fp,0); while ($running) {
while (($buf = fgets($fp, 4096)) != false) { $buffer .= $buf;
}
if ($buffer != "") {
switch ($buffer) {
case " ": { ncurses_end();
exit;
}
default: {
ncurses_mvwaddstr($full,2,2,"$buffer"); }
}
$buffer = ""; }
ncurses_mvwaddstr($full,4,4,microtime(true));
ncurses_wrefresh($full);
usleep(1); }
?>