8 single topics, 4 answers (ABCD), for different results.

8 single-choice questions, the result of each single-choice question can be (ABCD-one of the 4 values), how many kinds of results can be obtained?
how to output all the results with php?

Php
Oct.14,2021

A permutation and combination function previously written can obtain the

of the converted php by entering the character ABCD length 4.
<html>
    <head>
        <meta charset="utf8"/>
        <script>
            var html = '';
            function pl() {
                var str = document.getElementById('str').value;
                var len = parseInt(document.getElementById('len').value);
                len = len>1?len:1;
                var charts = str.split("");
                plr(charts,len)
                document.getElementById('result').innerHTML = html;
                html = '';
            }
            function plr () {
              var charts = arguments[0];
              var len = arguments[1];
              var pl = arguments[2]?arguments[2]:'';
              for (var i in charts) {
                rpl = pl + charts[i];
                if (len == 1) {
                  fillHtml(rpl);
                } else {
                  plr(charts, len-1, rpl);
                }
              }
            } 
            function fillHtml(str) {
                if (html == '') {
                    html = str;
                } else {
                    html = html + ';' + str;
                }
            }
        </script>
    </head>
    <body>
        :<input type="text" id="str">
        :<input type="text" id="len">
        <button onclick="pl()"></button>
        <div id="result"></div>
    </body>
</html>

$4 ^ 8 $$, using recursion to output

Menu