## Example 1 foreach($categories as $category){ $category_array[$category['cat_id']] = $category['cat_title']; } $categories = $category_array; ## Example 2 foreach($appertisers as $row ){ $array[] = $row->product; }