PHP calculating the intersect of arrays
<p>Array declaration: <code>$uids = array();</code></p>

<p>Next these arrays may or may not be created:</p>

<pre><code>$uids['locations'];
$uids['ages'];
$uids['genders'];
</code></pre>

<p>If at least 2 of them are created I want to calculate the intersect. If all 3 are created I want the intersect of all 3.</p>

<p>So, I may want to calculate the intersect of <code>$uids['locations']</code> and <code>$uids['ages']</code> or the intersect of <code>$uids['ages']</code> and <code>$uids['genders']</code>, etc.</p>

<p>If put all 3 arrays in array_intersect then I get errors if one of them is not an array. I'm not sure how to handle this without an awful lot of if:else statements and think there is a better way.</p>
