title: How to get all possible combinations of multidimensional array
body: <p>Okay, here I have a multidimensional array. It consists of 3 arrays each with 3 numbers.</p>
  
  <pre><code>$numbers = array(
      array("1", "2", "3"),
      array("4", "5", "6"),
      array("7", "8", "9"),
  );
  </code></pre>
  
  <p>I want to generate and list every possible combination of the numbers from these arrays. So for example, "147" (1 being from the first array, 4 being from the second array and 7 being from the third array), "247, 347, 157, 257, 357, 167, 267, 367, etc..."</p>
  
  <p>The important thing is that the first number must come from the first array, the second number from the second array and the third from the third array.</p>
  
  <p>I have tried to loop through these arrays using nested foreach loops, but I can't quite figure it out and it's making my head spin. Hope that makes sense, any help would be greatly appreciated.</p>