multi dimensional php associative array -


i have php code

      $rtperdate['revenue'][$dategroupped['date']] += $telco['revenue'];       $rtperdate['traffics'][$dategroupped['date']] += $telco['traffics']; 

which produce array

array( [revenue] => array     (         [2015-10-01] => 166600         [2015-10-02] => 578300     ) [traffics] => array     (         [2015-10-01] => 167         [2015-10-02] => 576     ) 

i want make array looks this

array( [0] => array     (         [revenue] => 166600         [traffics] => 167         [date] => 2015-10-01     ) [1] => array     (         [revenue] => 578300         [traffics] => 576         [date] => 2015-10-02     ) 

any appreciated. thanks

edit

do perhaps mean want indexed date?

$rtperdate[$dategroupped['date']]['revenue'] += $telco['revenue']; $rtperdate[$dategroupped['date']]['traffics'] += $telco['traffics'];  array( [2015-10-01] => array     (         [revenue] => 166600         [traffics] => 578300     ) [2015-10-02] => array     (         [revenue] => 167         [traffics] => 576     ) 

initial answer

something this?

$rtperdate[0]['revenue'] += $telco['revenue']; $rtperdate[0]['traffics'] += $telco['traffics']; $rtperdate[0]['date'] = $dategroupped['date'];  $rtperdate[1]['revenue'] += $telco['revenue']; $rtperdate[1]['traffics'] += $telco['traffics']; $rtperdate[1]['date'] = $dategroupped['date']; 

Comments

Popular posts from this blog

javascript - Slick Slider width recalculation -

jsf - PrimeFaces Datatable - What is f:facet actually doing? -

angular2 services - Angular 2 RC 4 Http post not firing -