我有一系列食谱。每个食谱都包含一系列成分:
[Waffle] => Array
(
[0] => stdClass Object
(
[amount] => 1
[measurement] => large
[ingredient] => egg
[grocery] => dairy
)
[1] => stdClass Object
(
[amount] => 1
[measurement] => cup
[ingredient] => milk
[grocery] => dairy
)
)
[Pancake] => Array
(
[0] => stdClass Object
(
[amount] => 1
[measurement] => large
[ingredient] => egg
[grocery] => dairy
)
[1] => stdClass Object
(
[amount] => 1
[measurement] => tablespoon
[ingredient] => maple syrup
[grocery] => pantry
)
)
我想创建一个所有成分的杂货清单,按成分和尺寸编制数量,并根据杂货店过道订购。
因此,鉴于上述情况,它将输出如下内容:
DAIRY
2 large eggs
1 cup milk
PANTRY
1 tablespoon maple syrup
您可以提供任何帮助来编写函数来执行此操作,我们将不胜感激。