You will need to use REGEXP.
If you have "laslb" you will need to do something like this
You will need to turn the entered word into an array -
array (l => 2, a => 1, s => 1, b => 1)
using something like -
$length = strlen($word);
$i = 0;
while ($i < $length) {
$word_array[] = substr($word, $i, 1);
$i++;
}
$word_array = array_count_values($word_array);
- so each letter is represented only once but you know the number of instances of each letter.
Then you will need to dynamically build the REGEXP so that you end up with something like this -
word REGEXP "l{2} a{1} s{1} b{1}"
This will only match "llasb" as it stands but it should be enough to get you started in the right direction. You will need to read up on REGEXP and figure out how to do it.
If I figure out the REGEXP I'll post again.
Sorry I can't help more 😉