Detect/read key pressed, cross-platform PHP CLI Detect/read key pressed, cross-platform PHP CLI php php

Detect/read key pressed, cross-platform PHP CLI


Unfortunately, this is not possible (still today) without a similar platform-specific extension for Windows like the ones for *n*x (readline, ncurses).

Worse yet, even if you give up the cross-platform requirement, I doubt that there's any such (reasonably well-known) extension for that on Windows. (People tend to recommend writing the bindings for things like pdcurses (which is at least itself cross-platform) yourself, since apparently no-one has quite done and published one yet.)

Things are slowly progressing though, and at least the readline extension is now available for Windows (since 7.1), but it happens to be just short of the unbuffered char read functionality...