Mad Lib Functions


In this project, we’ll use PHP to write a function to fill in a Mad Libs story! Mad Libs are short stories with blank spaces, which get filled in by the user. The result is usually funny (or strange).

Mad Libs require:

  • A short story with blank spaces (asking for different types of words).
  • Words to fill in those blanks.

“Roses are Red” poem example:

For this project, we provide the story, but it will be up to you to create a function that:

  1. Takes desired words as arguments.
  2. Returns the story with the words put into blanks in the right place.

Let’s begin!