PHP: How do you generate all possible combinations of values in an array?
<blockquote>
  <p><strong>Possible Duplicate:</strong><br>
  <a href="http://stackoverflow.com/questions/1256117/algorithm-that-will-take-numbers-or-words-and-find-all-possible-combinations">algorithm that will take numbers or words and find all possible combinations</a>  </p>
</blockquote>



<p>If I have an array such as:</p>

<pre><code>array('a', 'b', 'c', 'd');
</code></pre>

<p>How would I create a new array with all possible combinations of those 4 values such as</p>

<pre><code>aaaa, aaab, aaac, aaad ... dddb, dddc, dddd
</code></pre>

<p>Thanks!    </p>
