I have an array with this structure (this is one of the entries):
[11] => Array
        (
            [id_cred] => CD000000905
            [gbv_tot] => 482197.51
            [ammesso] => 482197.51
            [tipo] => 1
            [importo] => 0
            [stato] => aperta
        )
I loop through it in a foreach to set [importo] to be equal to [gbv_tot] or [ammesso] based on some conditions. I wrote this code but seems not to update the value of the key [importo].
foreach($creds as $cred){
    if(($cred['tipo'] == '1')&&($tipo_az == 'conc')){
        //sto elaborando un chirografo in una azione concorsuale quindi prendo il nominale
        if($cred['stato']=='aperta'){
            $gbv_compl = $gbv_compl + $cred['ammesso'];
            $cred['importo'] = $cred['ammesso'];
        }else{
            $cred['importo'] = 0;
        }
    }else{
        //sto elaborando qualcosa d'altro e quindi prendo il GBV
        if($cred['stato']=='aperta'){
            $gbv_compl = $gbv_compl + $cred['gbv_tot'];                 
            $cred['importo'] = $cred['gbv_tot'];
        }else{
            $cred['importo'] = 0;
        }
    }
}
I think this is not the right way to do it since I cannot get [importo] to be updated. What am I missing?
 
     
    