DeyaEldeen DeyaEldeen - 1 year ago 72
PHP Question

how to construct an SQLite3 database with all possible words with 3 letters?

say I need to build a database with all possible 3 letters combinations


what is the approach to do that?

~ a mac can run python or php, so any of these 2 languages would be more preferred, thanks.

Answer Source

If you're only after A-Z then you can simply use a 3-level for loop, example


for ($x=65; $x<=91; $x++) {
    for ($y=65; $y<=91; $y++) {
        for ($z=65; $z<=91; $z++) {
            $chars = chr($x).chr($y).chr($z);
            // persist to database

These aren't words, just every possible combination of 3 A-Z characters

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download