I have two array, one array has color and another array has fruits, here I want to combine using matching color reference. How to combine by using array reference?
$fruits = ['yellow', 'green', 'orange'];
$relatedFurites = [
['yellow'=>'banana', 'green'=>'avacado'],
['yellow'=>'mango', 'green'=> 'chilli']
];
expected output by using array refernce
$output = [
'yellow'=>['banana', 'mango'],
'green'=>['avacado', 'chilli']];
Thanks for all suggestions.