Ask to generate letters and numbers

Source: Internet
Author: User
Ask to generate letters and numbers with 26 letters {a-Z} and 10 digits {0-9}
If you want to generate 8-character, case sensitive,
Such an arrangement is (26 + 26 + 10) the power of 8 = 218340105584896, which is 218 trillion
However, there cannot be two or more identical adjacent characters, such as {a1b2cc90. this character appears twice}
Can such data be produced using PHP?
It is not possible to generate a single text data, so you have to cut it into multiple copies ......


Reply to discussion (solution)

What does this mean?

$d = str_split('abcd');print_r(array_map('join', f(4, $d)));function f($n, $d) {  $t = array_chunk($d, 1);  if($n > 2) $t = f($n-1, $d);  foreach($t as $x)    foreach(array_chunk($d, 1) as $y) {      if(end($x) != end($y)) $r[] = array_merge($x, $y);    }  return $r;}
Array(    [0] => abab    [1] => abac    [2] => abad    [3] => abca    [4] => abcb    [5] => abcd    [6] => abda    [7] => abdb    [8] => abdc    [9] => acab    [10] => acac    [11] => acad    [12] => acba    [13] => acbc    [14] => acbd    [15] => acda    [16] => acdb    [17] => acdc    [18] => adab    [19] => adac    [20] => adad    [21] => adba    [22] => adbc    [23] => adbd    [24] => adca    [25] => adcb    [26] => adcd    [27] => baba    [28] => babc    [29] => babd    [30] => baca    [31] => bacb    [32] => bacd    [33] => bada    [34] => badb    [35] => badc    [36] => bcab    [37] => bcac    [38] => bcad    [39] => bcba    [40] => bcbc    [41] => bcbd    [42] => bcda    [43] => bcdb    [44] => bcdc    [45] => bdab    [46] => bdac    [47] => bdad    [48] => bdba    [49] => bdbc    [50] => bdbd    [51] => bdca    [52] => bdcb    [53] => bdcd    [54] => caba    [55] => cabc    [56] => cabd    [57] => caca    [58] => cacb    [59] => cacd    [60] => cada    [61] => cadb    [62] => cadc    [63] => cbab    [64] => cbac    [65] => cbad    [66] => cbca    [67] => cbcb    [68] => cbcd    [69] => cbda    [70] => cbdb    [71] => cbdc    [72] => cdab    [73] => cdac    [74] => cdad    [75] => cdba    [76] => cdbc    [77] => cdbd    [78] => cdca    [79] => cdcb    [80] => cdcd    [81] => daba    [82] => dabc    [83] => dabd    [84] => daca    [85] => dacb    [86] => dacd    [87] => dada    [88] => dadb    [89] => dadc    [90] => dbab    [91] => dbac    [92] => dbad    [93] => dbca    [94] => dbcb    [95] => dbcd    [96] => dbda    [97] => dbdb    [98] => dbdc    [99] => dcab    [100] => dcac    [101] => dcad    [102] => dcba    [103] => dcbc    [104] => dcbd    [105] => dcda    [106] => dcdb    [107] => dcdc)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.