Create associative array from Foreach Loop PHP

keiren09

New Member
I have this foreach loop:\[code\]foreach($aMbs as $aMemb){ $ignoreArray = array(1,3); if (!in_array($aMemb['ID'],$ignoreArray)){ $aMemberships[] = array($aMemb['ID'] => $aMemb['Name']); }}\[/code\]This prints out the right fields but they are arrays inside arrays. I need the foreach loop to output a simple array like this one:\[code\]$aMemberships = array('1' => 'Standard', '2' => 'Silver');\[/code\]What am I doing wrong?
 
Back
Top