I'm trying to use array_intersect
to compare two arrays of arrays.
$start[]=array(
'id'=>1,
'name'=>'Up',
'action'=>'up'
);
$start[]=array(
'id'=>3,
'name'=>'Down',
'action'=>'down'
);
$start[]=array(
'id'=>5,
'name'=>'Left',
'action'=>'left'
);
$end[]=array(
'id'=>1,
'name'=>'Up',
'action'=>'up'
);
$end[]=array(
'id'=>9,
'name'=>'Up',
'action'=>'up'
);
$result=array_intersect($start,$end);
However, I always get the notice message:
Notice: Array to string conversion in testfile.php on line xyz
And the comparison doesn't actually occur.
What is the best way to compare the two arrays without reinventing the wheel or arriving at something overly complex?