title: Very fast permutations in PHP
body: <p>I have searched the internet in great detail and found many samples of PHP scripts that are addressing permutations. All these scripts are ok for permuting a few numbers and a few words here and there but when we get to perform some heavy stuff I can't execute the code.</p>
  
  <p>Here is the essence of the thing we need and things I did.</p>
  
  <p>I have to find all unique combinations of a range of numbers from 1 to 8.
  I do this easily,, no problems there...</p>
  
  <p>Then I have to permute each combination which should result with a crazy number results,, and then I have to perform string replacements on each result...</p>
  
  <p>I know this is intense,,, and I do manage to get it done with numbers up to 6. </p>
  
  <p>6 Executes pretty slow,, and 7 and 8 simply mess with the memory allocation on the machine.</p>
  
  <p>My primary question is</p>
  
  <p>Is there a way I can do permutations super fast? Preferably without affecting memory too badly... AND how fast can in PHP realistically a few million records be displayed (doing it in command line,,, browser doesn't matter here)</p>