handling large arrays with array_diff
<p>I have been trying to compare two arrays. Using array_intersect presents no problems. When using array_diff and arrays with ~5,000 values, it works. When I get to ~10,000 values, the script dies when I get to array_diff. Turning on error_reporting did not produce anything.</p>

<p>I tried creating my own array_diff function:</p>

<pre><code>function manual_array_diff($arraya, $arrayb) {
    foreach ($arraya as $keya =&gt; $valuea) {
        if (in_array($valuea, $arrayb)) {
            unset($arraya[$keya]);
        }
    }
    return $arraya;
}
</code></pre>

<p>source: <a href="http://stackoverflow.com/questions/2479963/how-does-array-diff-work">http://stackoverflow.com/questions/2479963/how-does-array-diff-work</a></p>

<p>I would expect it to be less efficient that than the official array_diff, but it can handle arrays of ~10,000. Unfortunately, both array_diffs fail when I get to ~15,000.</p>

<p>I tried the same code on a different machine and it runs fine, so it's not an issue with the code or PHP. There must be some limit set somewhere on that particular server. Any idea how I can get around that limit or alter it or just find out what it is?</p>
