I have a terminal-based php program that basically just runs in a big for loop, does a bunch of stuff and then quits. I would like to be able to interrupt the loop, either pausing or quitting the app. Currently I have to hit ^C to quit the app (or kill it from another terminal screen). Any ideas how I might implement this?
Running program...
[Press Q to quit and <spacebar> to pause at any time]
text
text
text
...
more text scrolling by
I get how to quit and how to pause, that's easy enough, but I'm not sure how to monitor for input while doing tons of other functions.
Thanks much!