$q = file_get_contents("https://steamcommunity.com/id/ezimbalance/inventory/json/730/2");
$json = json_decode($q, true);
$item_array = [];
foreach ($json['rgInventory'] as $v) {
$classid = $v['classid'];
$instanceid = $v['instanceid'];
$classid_instanceid = $classid."_".$instanceid;
$marketnames[] = $json['rgDescriptions'][$classid_instanceid]['market_hash_name']; //заполняем массив с именами итемов
$item_name = $json['rgDescriptions'][$classid_instanceid]['name'];
$rarity = $json['rgDescriptions'][$classid_instanceid]['tags'][4]['name'];
$quality = $json['rgDescriptions'][$classid_instanceid]['tags'][5]['name'];
$market_hash_name = $json['rgDescriptions'][$classid_instanceid]['market_hash_name'];
if (empty($quality) && empty($rarity)) {
if ($lng == "ru") {
$rarity = "Базового класса";
$quality = "Контейнер";
} else {
$rarity = "Base Grade";
$quality = "Container";
}
}
$id = $v['id'];
$item_array[] = ["id" => $id, "item_name" => $item_name, "rarity" => $rarity, "quality" => $quality, "classid" => $classid, "rarity" => $rarity, "quality" => $quality, "instanceid" => $instanceid, "classid_instanceid" => $classid_instanceid, "market_hash_name" => $market_hash_name, "price" => 0];
}
$getprices = $db->query("SELET * FROM `prices` WHERE `market_hash_name` IN(?list)", [$marketnames], 'assoc'); //Получаем цены ко всем
Как мне в конец массива каждого элемента "market_hash_name" == $getprices['market_hash_name'] дописать результат из базы? Запрос возвращает $getprices['price'], $getprices['market_hash_name']
Извиняюсь за такую даунскую формулировку, но надеюсь кто то поймет что я хочу)