I have arrays dishes
and favorites
. My goals is to add a field to the dishes
array if a certain dish occurs in the favorites
one. This is what I have tried but it doesn't seem to be working since I get an empty array back.
$boundDishes = [];
foreach ($dishes as $dish) {
foreach ($favorites as $favorite) {
if ($favorite == $dish) {
$dishes['favorite'] = true;
$boundDishes[] = $dish;
}
}
}
return $boundDishes;
Am I doing something wrong or is there a better way?
Any help is very much appreciated!
Many thanks in advance!!