KFC
Guest
произвольное кол-во аргументов для array_intersect()
можно ли передать произвольное кол-во аргументов для array_intersect() ?
можно ли передать произвольное кол-во аргументов для array_intersect() ?

function varArg()
{
return $arg_list = func_get_args();
}
$b=varArg($final[0],$final[1],$final[2],$final[3],$final[4],..., $final[n]);
$full=array_intersect($b);
if(sizeof($final)==1){$full=$final[0];}
elseif(sizeof($final)==2){ $full=array_intersect($final[0],$final[1]);}
elseif(sizeof($final)==3){ $full=array_intersect($final[0],$final[1],$final[2]);}
elseif(sizeof($final)==4){ $full=array_intersect($final[0],$final[1],$final[2],$final[3]);}
а как ты знаешь ЧТО сюда писать?$b=varArg($final[0],$final[1],$final[2],$final[3],$final[4],..., $final[n]);
пара цитат:Автор оригинала: Net Dog
[m]eval[/m]'ом если уж очень так хочется
Be careful when using eval() on heavy usage sites in PHP 4.0+ as it takes vastly longer to activate due to the limitations of the Zend engine.
The Zend engine changes the PHP to a binary structure at the START of the file, and then parses it. Every time an eval is called, however, it has to reactivate the parsing procedure and convert the eval()'d code into usable binary format again.
Basically, if you eval() code, it takes as long as calling a new php page with the same code inside.
If eval() is the answer, you're almost certainly asking the
wrong question. -- Rasmus Lerdorf, BDFL of PHP
$full=call_user_func_array('array_intersect',$any_number_of_arrays_here);