[php] Cannot use string offset as an array in php

I was having this error and a was nuts

my code was

$aux_users='';

foreach ($usuarios['a'] as $iterador) { 
#code
if ( is_numeric($consultores[0]->ganancia) ) {
    $aux_users[$iterador]['ganancia']=round($consultores[0]->ganancia,2);
  }
}

after changing $aux_users=''; to $aux_users=array();

it happen to my in php 7.2 (in production server!) but was working on php 5.6 and php 7.0.30 so be aware! and thanks to Young Michael, i hope it helps you too!