<? $return = array(); foreach ($data as $info => $id) { $return = array_merge($return, array($id => array('Text' => $info))); } ?>