I'm trying to make a PHP website that gets information out of (a large) array.
The array looks like this:
"playerstats": {
"steamID": "MyID",
"gameName": "ValveTestApp260",
"stats": [
{
"name": "total_kills",
"value": 35342
},
{
"name": "total_deaths",
"value": 30465
},
{
"name": "total_time_played",
"value": 1952281
so on and so on...
The way I'm accessing it right now is by using:
$kills = $jsonforgame['playerstats']['stats'][0]['value'];
$deaths = $jsonforgame['playerstats']['stats'][1]['value'];
the problem is that I have hundreds of 'stats' in the array, is there a way to access all the value's with the name (like total_kills & total_deaths) instead of having to count all the arrays?
Thanks for reading :)