title: All possible combinations in array - recursion?
body: <p>I have a question that goes over my head, hope someone can help. I think it may have to be solved by recursion and/or permutations, but I am not good enough of a (PHP) programmer for that.</p>
  
  <pre><code>$map[] = array("0", "1", "2", "3");
  $map[] = array("4", "5", "6", "7");
  $map[] = array("8", "9", "10", "11");
  $map[] = array("12", "13", "14", "15");
  $map[] = array("16", "17", "18", "19");
  $map[] = array("20", "21", "22", "23");
  </code></pre>
  
  <p>The $map array is limited to a max length of "6".</p>
  
  <p>I am looking for a way to make all possible combinations. Here are a few VALID combinations:</p>
  
  <p>Example 1:</p>
  
  <pre><code>$map[] = array("0", "1", "2", "3", "4", "5", "6", "7");
  $map[] = array("8", "9", "10", "11");
  $map[] = array("12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", );
  $map[] = array("23");
  </code></pre>
  
  <p>Example 2:</p>
  
  <pre><code>$map[] = array("0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23");
  </code></pre>
  
  <p>Example 3:</p>
  
  <pre><code>$map[] = array("0", "1");
  $map[] = array("2", "3", "4", "5", "6", "7", "8");
  $map[] = array("9", "10", "11");
  $map[] = array("12");
  $map[] = array("13", "14", "15", "16", "17", "18", "19", "20");
  $map[] = array("21", "22", "23");
  </code></pre>
  
  <p>The values in each of the map arrays have to be in ascending order, e.g. this example is INVALID:</p>
  
  <pre><code>$map[] = array("0", "1", "4");
  $map[] = array("3", "5");
  etc...
  </code></pre>
  
  <p>Hope this can be done.</p>