I need a very specific function in PHP. Basically, I have two strings as arguments, one of which is a pattern that contains wildcards of variable length (*), and one of which is a string that matches that pattern. I need to get an array of the strings from the latter string that fill in the wildcards in the pattern.
For example:
- Argument 1: "This is * string that I *"
- Argument 2: "This is my awesome string that I created myself"
- Return: array("my awesome","created myself")
What's the cleanest way to do this? Bear in mind that these are not always strings of english words as in the example, they could be any random characters.