$data[$category][] = $item;

Read more of this post