Advertisement
Guest User

Untitled

a guest
Apr 7th, 2014
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.41 KB | None | 0 0
  1. $output = array();
  2.  
  3.         // Iterate over the main array and create a new subarray if
  4.         // it doesn't already exist, or add to it if it does.
  5.         foreach($raw_array as $subarr) {
  6.             if (!isset($output[$subarr->dropdownsId])) {
  7.                 // New array indexed by sid
  8.                 $output[$subarr->dropdownsId] = array();
  9.             }
  10.             // Append the whole array
  11.             $output[$subarr->dropdownsId][] = $subarr;
  12.         }
  13.        
  14.         return $output;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement