Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $output = array();
- // Iterate over the main array and create a new subarray if
- // it doesn't already exist, or add to it if it does.
- foreach($raw_array as $subarr) {
- if (!isset($output[$subarr->dropdownsId])) {
- // New array indexed by sid
- $output[$subarr->dropdownsId] = array();
- }
- // Append the whole array
- $output[$subarr->dropdownsId][] = $subarr;
- }
- return $output;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement