php - array_sum() to values within an array -
how can add array_sum string in loop without making foreach loop it? trying combine of numbers instead of having multi dimensional array , have value , see array_sum wont add them because inside of array. ideas? $hours_arr = array(); foreach($proj_time $item){ $hours_arr [$item['project_id']]['item_value'] = $item['item_value']; $hours_arr [$item['project_id']]['hours'][] = $item['hours']; } //output array (size=3) 4 => array (size=2) 'item_value' => string 'coaching' (length=8) 'hours' => array (size=1) 0 => string '999.99' (length=6) 1487 => array (size=2) 'item_value' => string 'standby' (length=7) 'hours' => array (size=1) 0 => string '15.00' (length=5) 1488 => array (size=2) 'item_value' => string 'standby' (length=7) ...