I want to write a PHP script that I can use from the command line. I want it to prompt and accept input for a few items, and then spit out some results. I want to do this in
The algorithm is simple:
until done:
display prompt
line := read a command line of input
handle line
It's very trivial to use an array that maps commands to callback functions that handle them. The entire challenge is roughly a while loop, and two function calls. PHP also has a readline interface for more advanced shell applications.