I am having problems in PHP creating functional arguments made up of arrays separated by commas, for example I want to automate the use of the array_intersect
function.
The function accepts multiple arrays separated by comma's as its function arguments. E.g.:
array_intersect($setarray1, $setarray2, $setarray3, ...)
I have hundreds of different array's to process in the array_intersect
function (i.e I may pass 3, 4 of 5 arrays to the function at a time).
My question is, how do I create a function argument made up of comma separated arrays that I can then pass to the array_intersect
function?
Here is an example of some test data
$setsarray[]=array('all','0' ,'0&1','0&2','0&3');
$setsarray[]=array('all' ,'1' ,'0&1' ,'1&2','1&3');
$setsarray[]=array('all' ,'2' ,'0&2' ,'1&2' ,'2&3');
$setsarray[]=array('all' ,'3' ,'0&3' ,'1&3','2&3');
$setnumb=count($setsarray);
Manually I can do this...
$vennGraph['all']=array_intersect(
$setsarray[$setnumb-4],$setsarray[$setnumb-3], $setsarray[$setnumb-2]
);
The function arguments are array comma array comma array e.t.c. So I want to to generate $vennGraph['Again_and_Again']=array_intersect("put my content here");
I have been reading through the responses (thankyou!) and they sound promising but I am still dumb struck! BTW, I am using PHP Version 5.3.10
ps would it be easier if I put commas into the $setsarray as shown below?
$setsarray[]=array('all','0' ,'0&1','0&2','0&3');
$setsarray[]= ',';
$setsarray[]=array('all' ,'1' ,'0&1' ,'1&2','1&3');
$setsarray[]= ',';
$setsarray[]=array('all' ,'2' ,'0&2' ,'1&2' ,'2&3');
$setsarray[]= ',';
$setsarray[]=array('all' ,'3' ,'0&3' ,'1&3','2&3');