$summonerMatches is an object that contains a property called matches which contains an array of objects. Each object contains information about the match like gameId.
In order to get the specific information about the match, I have to make a GET request using the gameId. I am currently looping through those matches and making a GET request to get the specific information about each match, however, I am wondering how to link the returned information to the respective match object inside the $summonerMatches object. In a way, I want to create a new property to each match and then assign it the result from the GET request in the loop.
$getSummonerMatches = file_get_contents($region . "/lol/match/v4/matchlists/by-account/gvgxEQIJUq3bvbR_oasXkFHY7oJ5G2WViBGVCL1eKGJXsg?startIndex=0&endIndex=10&api_key=" . $apiKey);
$summonerMatches = json_decode($getSummonerMatches);
foreach ($summonerMatches->matches as $match) {
$getMatchInfo = file_get_contents($region . "/lol/match/v4/matches/" . $match->gameId . "?api_key=" . $apiKey);
$matchInfo = json_decode($getMatchInfo);
}