I have a scenario that I think requires some kind of recursive iterations, but I am not certain, and not being an expert on recursive coding, I am drawing a blank.
Here is the scenario:
I have a phrase something like this:
[He|She] would [like|love|hate] to [Play Golf|Play Tennis|Play Baseball] Today.
I would like PHP to parse through that phrase (each section inside [] brackets represents possible variations for that word or phrase, each possibility separated by a | pipe), and generate all variations, so for example, the above would return:
He would like to Play Golf Today.
He would like to Play Tennis Today.
He would like to Play Baseball Today.
He would love to Play Golf Today.
He would love to Play Tennis Today.
He would love to Play Baseball Today.
He would hate to Play Golf Today.
He would hate to Play Tennis Today.
He would hate to Play Baseball Today.
She would like to Play Golf Today.
She would like to Play Tennis Today.
She would like to Play Baseball Today.
She would love to Play Golf Today.
She would love to Play Tennis Today.
She would love to Play Baseball Today.
She would hate to Play Golf Today.
She would hate to Play Tennis Today.
She would hate to Play Baseball Today.
I am trying to figure out how to write PHP code to take the inputted phrase, and return all possible sentences.