PHP illegal string offset warning

Ran across the PHP Joomla warning after upgrading one of my apps to Joomla 3.45:

Warning: Illegal string offset 'name' in

function golfLeagueShowFormats($formatObject){

$delimiter = ",";
$format_array = explode($delimiter, $formatObject);
foreach ($format_array as $format) {
$formatnumber = $format['name'];
golfLeagueGetFormatName($formatnumber);
//return 'poop';
}
}

It’s just a warning that only shows up in developer mode. Disabling developer mode would get rid of the warning but I decided to figure this out to make sure all the code was clean. Here’s the solution, to change $format[‘name’] to $format[0]


// convert format array to individual objects part 1
function golfLeagueShowFormats($formatObject){

$delimiter = ",";
$format_array = explode($delimiter, $formatObject);
foreach ($format_array as $format) {
$formatnumber = $format[0];
golfLeagueGetFormatName($formatnumber);
}
}