Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Random word from giving letter

Tags:

php

random

Is there any possible code for getting output in php(all possible word from word dictionary)

for example....for word "werflo"

  1. flower

  2. fowler

  3. reflow

  4. wolfer

like image 446
adwiz Avatar asked Jan 19 '26 08:01

adwiz


1 Answers

  1. Take your word list, order each word's letters (alphebetical or otherwise, as long as it's consistent).
  2. Associate each word with its ordered letter string
  3. Apply the same letter ordering to your input
  4. Find the matching words, which is now trivial as you just need to find those where the ordered letter sequence matches.
like image 196
Joey Avatar answered Jan 20 '26 21:01

Joey