I'm attempting to write a cross-platform PHP utility for personal use, not to reinvent anything. The code will run within more or less
while (true) {
    $key = null;
    $key = check_key_pressed();
    if ($key) do_relevant_magic($key);
    usleep(250000);
}
I need something for check_key_pressed() that will return a value of a pressed key, not waiting for EOF/EOL, not asking for input explicitly until any key is actually pressed.
This has to work on *nix and windows so ncurses is not an option. I also do not want exec calls to external vbs or bash scripts, it has to be done purely in PHP, hope I'm not wishing for too much.
EDIT: Of course I checked other SO solutions and none of them seems to be truly cross-platform. Ncrurses and readline are not available on windows and this has to intercept a keydown or keypress or input ready on both linux and windows.