<?php
$userData = [
[
"UID" => "5f10482574d83d4b726fe5",
"name" => "Yug Gill",
"orgID" => "5f10481d74d83d4b726",
"imageURL" => "female.png"
]
];
$userProductsData = [
[
"UPID" => "5f10482574d83d4b6fe007",
"UID" => "5f10482574d83d4b726fe5",
]
];
$userDetailsResult = [];
foreach ($userData as $key => $value) {
$userData[$key]["UPID"] = $userProductsData[$value["UID"]] ?? [];
}
预期输出
$userData = [
[
"UID" => "5f10482574d83d4b726fe5",
"name" => "Yug Gill",
"orgID" => "5f10481d74d83d4b726",
"imageURL" => "female.png",
"UPID" => "5f10482574d83d4b6fe007"
]
];
我有两个UID数组通用的数组,现在我想从中获取 UPID$userProductsData并推入$userData,我尝试过无法正常工作,请有人更新我的代码吗?>
猛跑小猪
慕工程0101907