title: Combine array values in PHP
body: <p>I have an Array with String values and want to combine these. Example Array:</p>
  
  <pre><code>Array("a", "b", "c");
  </code></pre>
  
  <p>Now I want an Array with all combinations of this String values in it. For this example:</p>
  
  <pre><code>Array("abc", "acb", "bac", "bca", "cab", "cba");
  </code></pre>
  
  <p>Each value should be included exactly one time. The problem is, that the length of this array is variable :-(</p>
  
  <p>I tried it so far with many foreach and for constructs but did not get the solution yet. I want to built a method like</p>
  
  <pre><code>function combineArrayValues ($arr)
  </code></pre>
  
  <p>I hope somebody can give me a hint, how to randomly combine the String and get all possible combinations for an Array with any length. Thank you!</p>
  
  <p>Best Regards,</p>
  
  <p>Richard</p>