I am getting the PHP Warning ‘Undefined array key 0 in’ on the following piece of code:
if ($reports[0]->rank == null) {
$output['result']['rank'] = 0; // no reports found
} else {
$output['result']['rank'] = $reports[0]->rank; // reports found, return lowest rank (highest warning level)
}
It is custom code I had written for a custom wordpress plugin a few years ago and unfortunately the web development company I used is no longer in business so I can’t go back to them. I’m really stuck and wondering if anyone could give me any tips as to how I could fix this. I note the site is running PHP 8 in case this is relevant.
Thanks