php - using array merge into a foreach loop -


i need merge new array of alternative information loop if have alternative information in profile.

here's loop:

foreach ($doctor->getvars() $k => $v)     {     $data['doctor_'. $k] = $v;     }  foreach ($patient->get_data() $k=>$v)     {     if (is_string($v) || is_numeric($v))         $data["patient_" . $k] = strtoupper($v);     }  

here's $data var_dump:

array (     [employee] => person     [date] => 05/08/2013     [datetime] => 05/08/2013 9:41:15     [department] => stuff     [employee_ext] => 7457     [employee_email] =>      [barcode] => *nzs01*     [doctor_df_code] => 09hq     [doctor_npi] => 1111111111     [doctor_dea] => b4574     [doctor_upin] =>      [doctor_license] =>      [doctor_phone] => (111)111-1111     [doctor_fax] => (000)000-0000     [doctor_fname] => undefined     [doctor_lname] => undefined     [doctor_title] =>      [doctor_intake_rx_caller_id] =>      [doctor_costco_rx_caller_id] =>      [doctor_reorder_rx_caller_id] =>      [doctor_address1] => 24 cabell st     [doctor_address2] => suite 10     [doctor_city] => places     [doctor_state] => ca     [doctor_zip] => 91111     [doctor_active_events] =>      [doctor_dont_call] => 0     [doctor_dont_fax] => 1 ) 

i need merge below array above array. here's print var function addr($dfcode):

array (     [0] => array         (             [code_] => 09hq             [doctor_address1] => alternate addy             [doctor_address2] => 45854             [doctor_city] => different city             [doctor_state] => ca             [doctor_zip] => 963545             [doctor_phone] => (619)111-2548             [doctor_fax] => (157)123-4569         )  ) 

i'm new array merge , i'm assuming right after $data['doctor_'. $k] = $v list out new function , fields want merge in particular?

syntax i'm not sure on:

$data['doctor_'. $k] . array_merge(addr($dfcode))['doctor_address1'] = $v; 

any appreciated, thank you.

the general formula merging 2 arrays follows (merging $array_m $array_o):

foreach($array_m $key=>$value){      $array_o[$key] = $value; } 

$array_o contain of elements of $array_m

edit: noticed in post seem want use array_merge function. following:

$array_o = array_merge($array_o, array_m); 

Comments

Popular posts from this blog

java - Jmockit String final length method mocking Issue -

asp.net - Razor Page Hosted on IIS 6 Fails Every Morning -

c++ - wxwidget compiling on windows command prompt -