I would like to implement a "press any key to continue" prompt, similar to many command-line programs, so that a script running under Windows (in particular) will stay open until the user dismisses it, allowing for time to read any messages.
I have the following code, but it only works if the ENTER key is the key pressed:
function anykey($s='Press any key to continue...') {
echo "\n".$s."\n";
fgetc(STDIN);
}
Is there a way to get just a single keystroke (in this case, it doesn't even matter what key is pressed), instead of waiting for the enter key?
Thank you for your time.
Kyle