I'm trying to simply match these letters using php, but it's kind-of a complex matching formula...
First, I have two arrays and one string. The arrays contain letters and the string is a near match of those letters.
$a - [Array] Must be <= 7
$b - [Array] Must be >= 0
$word - [String] Must contain letters from $a & $b. Letters can't be used twice.
The Goal: Create a word from those letters with complex matching. To start each word must contain one and only one $b letter, unless no $b letters are given. Next it must make sure that $word only contains letters from $a (it can't use letters twice but $a can contain the same letter) (and of course one or zero $b letters).
Example #1:
$a = R-E-O-E
$b = E-P
$word = Red
(The code should look at this an not accept it because $a nor $b doesn't contain a D)
Example #2:
$a = R-E-O-E
$b = E-P
$word = Peer
(The code should accept this because $b contains P and $a contains two E's and an R)
Note: This will be in a long loop with many different words.
Any help will be greatly appreciated!