Three letter complete list - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: Three letter complete list (/showthread.php?tid=30210) |
Three letter complete list - El Forum - 05-06-2010 [eluser]Total Shop UK[/eluser] I am trying to create a list that will contain every word using up to three letters. a,b,c...z aa,ab,ac...zz aaa,aab,aac...zzz Edit: worked it out but the other guys code looks cleaner Code: $letters=array('a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'); Three letter complete list - El Forum - 05-06-2010 [eluser]mddd[/eluser] You could make it even nicer by doing a recursive function to allow any length you want. But I think this will work. 1 to 3 letters in length. Code: $results = array(); Three letter complete list - El Forum - 05-06-2010 [eluser]Total Shop UK[/eluser] Looks very promising, but results using your code show Code: ja jaa jaa jaa jaa jaa jaa jaa jaa jaa jaa jaa jaa jaa jaa jaa jaa jaa jaa jaa jaa jaa jaa jaa jaa jaa jaa instead of Code: ja jaa jab jac jad jae jaf jag jah jai jaj jak jal jam jan jao jap jaq jar jas jat jau jav jaw jax jay jaz Three letter complete list - El Forum - 05-06-2010 [eluser]mddd[/eluser] My mistake. See the line : if ($c3) .... I wrote chr($2+96) in stead of chr($c3+96).. so it uses the second letter twice to build the word. Three letter complete list - El Forum - 05-06-2010 [eluser]Total Shop UK[/eluser] Many thanks |