As you have seen that PHP interacts smoothly with the console, it is particularly easy to make text-based games with PHP. However, thanks to the work of Brian Wang and Markus Fischer, you can even create graphical games with PHP. Naturally it is much easier to create text-based games, so that is where we will start.
The most popular type of text-based game is the adventure game, where all user input and feedback is given through textual descriptions. "GO NORTH", "GET AXE", "USE AXE ON MONSTER", etc. The nice thing about these games is that you can make them very simply, and strap on new features as you go - a famous example of this is NetHack, a text-based game for Unix that has been under development for two decades now and is still having new features added.
The game we're going to make will allow a person to navigate around a simple world and read the description of the places there. Once this is in place, you should be able to easily add the ability to pick up items, and let the player them in a selection of ways.