PHP Why would a loop suddenly stop and how to prevent it?
<p>I have what may seem like an obvious problem at first but here is my question anyway. I can't find any explanations that would help me resolve the problem so I hope for a little advice.</p>

<p>Here is what is happening.</p>

<p>I have two versions of the code that performs the same tasks,, one works flawlessly, another works just as well and just as fast for as long as the quantity of data to process is smaller than the first one.</p>

<p>In short,, </p>

<p>When it comes to the problem version...</p>

<p>When I permute and process arrays of reasonably smaller number of strings all executes fast but when I want to process a rather large set of strings (several hundred thousand) after about 70% of the execution the script just stops the output and sits. Again, no errors,, just freezes..</p>

<p>Note that I am outputing to CLI (comand prompt, on windows machine, apache server,, and I have plenty of RAM and CPU power)</p>

<p>Monitoring my machine performance it looks like CPU has A LOT to do. I do think this might be the issue with that one version of my code.</p>

<p>The only difference between version that works great and the one that doesn't is in ONE function and the one that stalls contains a lot of </p>

<pre><code>shuffle($array); 
</code></pre>

<p>calls which is the only thing I can think of as being a problem.</p>

<p>Is there a way to address this, to clean up something?</p>

<p>Any help would be appreciated. Thank you!</p>
