I am having a strange issue with Undefined index in my PHP code.
foreach ($arr as $event) {
$place = "";
$place = "Location: ".$event['locations']['title'];
}
And I am getting that error: Undefined index: locations in...
['locations']['title'] is coming from the JSON I am parsing.
I know that there are some reserved words like $this, etc. But don't think locations is one of these words.
I have tried also declaring the locations like this
$locations = "";
But still see the error in the logs.
JSON
[ {
"title":"8 Grand Pianos Concert (16 November 2019)",
"timeFrom":"2019-11-16 19:00:00",
"timeTo":"2019-11-16 22:00:00",
"listText":"Concerts in.....",
"url":"https://concert-16-november-2019",
"imageUrl":"https://8108273152422838272_o.jpg?f=62051",
"locations":{
"title":"Complex",
"url":"https://locations/complex"
}
}
]
This is the link to the source https://plovdiv2019.eu/en/feed/events/json