I have an output like this:
stdClass Object
(
[GetMatchdataByLeagueDateTimeResult] => stdClass Object
(
[Matchdata] => Array
(
[0] => stdClass Object
(
[teamId] => 40
Within a foreach loop
foreach ($allMatches as $match):
I woul like now to work with the data like follows:
if ($match->idTeam1 == $teamId || $match->idTeam2 == $teamId):
But I get this error:
Trying to get property of non-object
Reason is, that the Matchdata Array contains about 60+ entries and I want to filter those out where the [idTeam1] or [idTeam2] == a given id.
As result I should get only about 5 to 7 entries.
What is the best way to get this done when working with stdClass Object?
Please help!
Thanks!!
Assuming
$responseis the structure you posted: