📜  array_merge 在循环中使用,是一种资源贪婪构造. - 无论代码示例

📅  最后修改于: 2022-03-11 14:58:56.933000             🧑  作者: Mango

代码示例1
You can get the $arraysToMerge using the array_column() function on $users like
this:

$arraysToMerge = array_column($users, 'socialMediaAccounts');
$arraysMerged  = array_merge(...$arraysToMerge);

Matt suggested that you don't need to merge into an empty array, so I adapted 
the code to his suggestion.