Note that there are some explanatory texts on larger screens.

plurals
  1. POusing array merge into a foreach loop
    primarykey
    data
    text
    <p>I need to merge a new array of alternative information into the loop if they have the alternative information in their profile.</p> <p>Here's my loop:</p> <pre><code>foreach ($doctor-&gt;getVars() as $k =&gt; $v) { $data['doctor_'. $k] = $v; } foreach ($patient-&gt;get_data() as $k=&gt;$v) { if (is_string($v) || is_numeric($v)) $data["patient_" . $k] = strtoupper($v); } </code></pre> <p>Here's the $data var_dump:</p> <pre><code>Array ( [employee] =&gt; person [date] =&gt; 05/08/2013 [datetime] =&gt; 05/08/2013 9:41:15 AM [department] =&gt; stuff [employee_ext] =&gt; 7457 [employee_email] =&gt; [barcode] =&gt; *NZS01* [doctor_df_code] =&gt; 09HQ [doctor_npi] =&gt; 1111111111 [doctor_dea] =&gt; B4574 [doctor_upin] =&gt; [doctor_license] =&gt; [doctor_phone] =&gt; (111)111-1111 [doctor_fax] =&gt; (000)000-0000 [doctor_fname] =&gt; UNDEFINED [doctor_lname] =&gt; UNDEFINED [doctor_title] =&gt; [doctor_intake_rx_caller_id] =&gt; [doctor_costco_rx_caller_id] =&gt; [doctor_reorder_rx_caller_id] =&gt; [doctor_address1] =&gt; 24 CABELL st [doctor_address2] =&gt; SUITE 10 [doctor_city] =&gt; places [doctor_state] =&gt; CA [doctor_zip] =&gt; 91111 [doctor_active_events] =&gt; [doctor_dont_call] =&gt; 0 [doctor_dont_fax] =&gt; 1 ) </code></pre> <p>I need to merge the below array into the above array. Here's the print var for the function addr($dfcode):</p> <pre><code>Array ( [0] =&gt; Array ( [CODE_] =&gt; 09HQ [doctor_address1] =&gt; alternate addy [doctor_address2] =&gt; 45854 [doctor_city] =&gt; different city [doctor_state] =&gt; CA [doctor_zip] =&gt; 963545 [doctor_phone] =&gt; (619)111-2548 [doctor_fax] =&gt; (157)123-4569 ) ) </code></pre> <p>I'm new to array merge and I'm assuming right after the <code>$data['doctor_'. $k] = $v</code> i could list out the new function and the fields i want to merge in particular?</p> <p>syntax is what i'm not sure on:</p> <pre><code>$data['doctor_'. $k] . array_merge(addr($dfcode))['doctor_address1'] = $v; </code></pre> <p>Any help would be greatly appreciated, thank you.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload