Believe it or not, but the last 13 or so posts have all been leading up to this one. Generating random numbers, capturing user input, using colors on the command-line, pluralizing words, and then some are all being utilized in this simple number guessing game.
The script itself generates a random number between 1 and 100, asks the user to guess, advises them if they are too high or too low then tells them how many guesses it took them to guess the number:
To run the script, just execute it from the command-line:
number-guess.php for whatever you named the script and guess away!