Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Code:</p> <pre><code># initialize your test array $arry = array( 0 =&gt; array( 'id' =&gt; 86, '34' =&gt; 695, '39' =&gt; 0, '40.1' =&gt; 'Yes', '36.1' =&gt; 'Yes', '35.4' =&gt; 'Card', '33.3' =&gt; 'Dekalb', '33.4' =&gt; 'Illinois', '33.5' =&gt; '60115', '33.6' =&gt; 'United States', '35.1' =&gt; '1143', '33.1' =&gt; '5555 Write Rd', '33.2' =&gt; 'Write School', '32.6' =&gt; 'John', '32.3' =&gt; 'Smith', '28' =&gt; 'jsmith@gmail.com', '27' =&gt; '5555556554', '25' =&gt; 'NIUSN', '14.3' =&gt; 'Jane', '14.6' =&gt; 'Doe', '11.2' =&gt; '695', '12' =&gt; '1', '11.1' =&gt; 'In-Person', '3' =&gt; 0, '2.2' =&gt; 595, '2.1' =&gt; 'Online' ), 1 =&gt; array( 'id' =&gt; 86, '34' =&gt; 695, '39' =&gt; 0, '40.1' =&gt; 'Yes', '36.1' =&gt; 'Yes', '35.4' =&gt; 'Card', '33.3' =&gt; 'Dekalb', '33.4' =&gt; 'Illinois', '33.5' =&gt; '60115', '33.6' =&gt; 'United States', '35.1' =&gt; '1143', '33.1' =&gt; '5555 Write Rd', '33.2' =&gt; 'Write School', '32.6' =&gt; 'Douglas', '32.3' =&gt; 'Adams', '28' =&gt; 'douglas.adams@gmail.com', '27' =&gt; '5555556554', '25' =&gt; 'NIUSN', '14.3' =&gt; 'Frank', '14.6' =&gt; 'Wright', '11.2' =&gt; '695', '12' =&gt; '1', '11.1' =&gt; 'In-Person', '3' =&gt; 0, '2.2' =&gt; 595, '2.1' =&gt; 'Online' ) ); # How to do your function elegantly foreach($arry as $a) { $results[] = array( 'attendees_name' =&gt; $a['32.6'] . " " . $a['32.3'], 'attendees_email' =&gt; $a['28'], 'purchasing_name' =&gt; $a['14.3'] . " " . $a['14.6'] ); } # print results var_dump($results); </code></pre> <p>Results:</p> <pre><code>array(2) { [0]=&gt; array(3) { ["attendees_name"]=&gt; string(10) "John Smith" ["attendees_email"]=&gt; string(16) "jsmith@gmail.com" ["purchasing_name"]=&gt; string(8) "Jane Doe" } [1]=&gt; array(3) { ["attendees_name"]=&gt; string(13) "Douglas Adams" ["attendees_email"]=&gt; string(23) "douglas.adams@gmail.com" ["purchasing_name"]=&gt; string(12) "Frank Wright" } } </code></pre>
 

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