Transfer the mass to function only if it exists
-
We need to compare a few masses to a match.
$result = array_intersect($var_1,$var_2,$var_3,$var_4,$var_5,$var_6,$var_7);
If there's a mass, we'll hand it over if we don't, we'll compare the rest for everyone. If not
$var_2
But there's the, uh, the others.$result = array_intersect($var_1,$var_3,$var_4,$var_5,$var_6,$var_7);
if not$var_5,$var_6
But there's the, uh, the others.$result = array_intersect($var_1,$var_2,$var_3,$var_4,$var_7);
And so on.
-
- http://php.net/manual/ru/function.call-user-func-array.php - causes a function with a set of parameters.
- http://php.net/manual/ru/function.array-filter.php filtering the mass.
The plan is that only the non-desert elements are left from the masses and are transmitted to them.
array_intersect()
:$result = call_user_func_array( 'array_intersect', array_filter( array( $var_1,$var_2,$var_3,$var_4,$var_5,$var_6,$var_7 ), function($a){ return isset($a) && is_array($a) && !!count($a);} ) );
http://ideone.com/hWmlwL