I have 2 arrays and I want to match both arrays.If the value from array 1 is not present in array 2 then I would like to put 0 for that element.
Array 1
$weeksArr = array("p1","p2","p3","p4");
Array 2
$dailyArr = array(
"0"=>array("p1","123"),
"1"=>array("p2","125"),
"2"=>array("p4","126")
);
After joining I would like to the final array to be
$finalArr = array(
"0"=>array("p1","123"),
"1"=>array("p2","125"),
"2"=>array("p3","0"),
"3"=>array("p4","126")
);
So I would like to insert p3 inside final array.
Any hint/suggestion is highly welcomed. Thanks in advance.
array_intersectare very useful for that kind of things