php array acces issue -


i have 2 arraws i'm storing data: activos[key][value] , pagos[key][value]

the operation want each "activo" element value , coincides key on pagos sum value of array variable.

i've tryed doesn't work supposed to:

$t = 0; foreach ($activos $key => $value) {     foreach ($pagos $key => $value) {         if($activos[$value] == $pagos[$key]){             $t += $pagos[$key]         }     } } 

you've key , value both arrays, you've erased them !!

$t = 0; foreach ($activos $keyactivos => $valueactivos) {     foreach ($pagos $keypagos => $valuepagos) {         if($valueactivos == $keypagos){             $t += $valuepagos;         }     } } 

Comments

Popular posts from this blog

java - Run spring boot application error: Cannot instantiate interface org.springframework.context.ApplicationListener -

reactjs - React router and this.props.children - how to pass state to this.props.children -

Excel VBA "Microsoft Windows Common Controls 6.0 (SP6)" Location Changes -