how can I get the "avatarmedium" from i json without a foreach Loop? Thats my current Code:
$json = '{
"response": {
"players": [
{
"steamid": "76561198019025166",
"avatarmedium": "https://steamcdn-a.akamaihd.net/steamcommunity/public/images/avatars/d3/d3ca76e0f1e8d071e826bc3baeebd0e7215e50e2_medium.jpg"
}
]
}
}';
$result = json_decode ($json);
echo $json->response[0]->players->profileurl;
<?php
$json = '{
"response": {
"players": [
{
"steamid": "76561198019025166",
"avatarmedium": "https://steamcdn-a.akamaihd.net/steamcommunity/public/images/avatars/d3/d3ca76e0f1e8d071e826bc3baeebd0e7215e50e2_medium.jpg"
}
]
} }';
$result = json_decode ($json);
echo $result->response->players[0]->avatarmedium;