Every permutation of the alphabet up to 29 characters?

后端 未结 13 1313
攒了一身酷
攒了一身酷 2021-02-11 01:23

I\'m attempting to write a program that will generate a text file with every possible permutation of the alphabet from one character up to twenty-nine characters. I\'ve chosen 2

13条回答
  •  野的像风
    2021-02-11 02:01

    Using PHP's Perl-style character incrementing.

    set_time_limit(0);
    
    $perm = 'A';
    $endTest = str_repeat('Z',28).'A';
    while ($perm != $endTest) {
        echo $perm++,"\n";
    }
    

    Run the script from the command line so you don't hit a webserver timeout; then sit back and wait a few years for it to complete

提交回复
热议问题