Can't you reference the data by the array's index? So $inv['descriptions'][0] for example.
Perhaps you need to iterate over the array being returned?
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
i have the following api (https://steamcommunity.com/inventory/76561198087029659/730/2) the have the key of 'description' to get the items.
$steamID= 76561198087029659;
$inventoryJsonUrl = 'http://steamcommunity.com/inventory/'.$steamID.'/730/2';
$inventoryJsonGet = file_get_contents($inventoryJsonUrl);
$inv = json_decode($inventoryJsonGet, TRUE);
dd($inv['descriptions']);
This code give me the following values https://imgur.com/XEU93Dj
Issues it that 'descriptions key ' contain again an list of array and i need to get that data someting like
$item['name'],
$item['icon_url'],
$item['name_color'],
etc
Please help me . Thanks
What's wrong with foreach?
foreach($inv['descriptions'] as $item) {
$item['name'];
$item['icon_url'];
$item['name_color'];
// ...
}
Please or to participate in this conversation.