I have an array like this
$mapping = [
‘campaigns’ => null,
‘campaignView’ => null,
‘campaignViewItems’ => null,
‘filters’ => [
‘content’ => [
‘start’ => null,
‘end’ => null,
‘channel’ => null,
‘topic’ => null
]
] ];
and
$test = [
'campaigns' => [1,2,3],
'filters' => [
'content' => [
'channel' => [1,2,3],
'topic' => [10,11]
]
]
];
I want to have a function map ( $test, $mapping), then i will fill all attribute that $test missing by null value from $mapping
The result should be:
array : [
‘campaigns’ => [1,2,3],
‘campaignView’ => null,
‘campaignViewItems’ => null,
‘filters’ => [
‘content’ => [
‘start’ => null,
‘end’ => null,
‘channel’ => [1,2,3],
‘topic’ => [10,11]
]
] ];