Ok, here goes... I have an multi-dimensional array extracted from the database ($units) that is listed at the bottom of this e-mail. What I want to do is take this multi-dimensional array $units and maybe merge or extract it to a different array called $options. I want to group similar units into a category.
For example, I want to be able to group lbs. and oz. as units of weight. I want to group cm, m, in, ft as units of width, height or depth. I will be using this information to group these units into a drop-down menu on a form, specific to the category (caption_name). I've tried almost everything I could think of from the PHP Array manual to try to get this to group the way I want it, but all attempts have failed thus far. I even tried to combine these functions for a more complex answer, but I kept getting lost in it. Can anyone suggest of a simple and easy way to take the $units array and group it to something similar to the $options array? Both arrays are listed below, with $options being a pseudo-array that I'm trying to create from $units. Any help would be greatly appreciated... $options Array --------------- First dimension info: [0] = weight group [1] = width, height, or depth group [2] = volume group etc... --------------- Array ( [0] => Array ( [0] => Array ( [unit_id] = 1 [unit_option] = lbs. ) [1] => Array ( [unit_id] = 2 [unit_option] = oz. ) ) [1] => Array ( [0] => Array ( [unit_id] = 4 [unit_option] = cm. ) [1] => Array ( [unit_id] = 7 [unit_option] = m. ) [3] => Array ( [unit_id] = 5 [unit_option] = cm. ) [4] => Array ( [unit_id] = 6 [unit_option] = m. ) ) [2]... [3]... ) $units Array --------------- Array ( [0] => Array ( [0] => 1 [caption_id] => 1 [1] => weight [caption_name] => weight [2] => 1 [unit_id] => 1 [3] => lbs. [unit_option] => lbs. ) [1] => Array ( [0] => 1 [caption_id] => 1 [1] => weight [caption_name] => weight [2] => 2 [unit_id] => 2 [3] => oz. [unit_option] => oz. ) [2] => Array ( [0] => 2 [caption_id] => 2 [1] => volume [caption_name] => volume [2] => 3 [unit_id] => 3 [3] => fl. oz. [unit_option] => fl. oz. ) [3] => Array ( [0] => 2 [caption_id] => 2 [1] => volume [caption_name] => volume [2] => 11 [unit_id] => 11 [3] => L [unit_option] => L ) [4] => Array ( [0] => 2 [caption_id] => 2 [1] => volume [caption_name] => volume [2] => 12 [unit_id] => 12 [3] => mL [unit_option] => mL ) [5] => Array ( [0] => 2 [caption_id] => 2 [1] => volume [caption_name] => volume [2] => 13 [unit_id] => 13 [3] => cm³ [unit_option] => cm³ ) [6] => Array ( [0] => 3 [caption_id] => 3 [1] => width [caption_name] => width [2] => 5 [unit_id] => 5 [3] => in. [unit_option] => in. ) [7] => Array ( [0] => 3 [caption_id] => 3 [1] => width [caption_name] => width [2] => 4 [unit_id] => 4 [3] => cm. [unit_option] => cm. ) [8] => Array ( [0] => 3 [caption_id] => 3 [1] => width [caption_name] => width [2] => 7 [unit_id] => 7 [3] => m. [unit_option] => m. ) [9] => Array ( [0] => 3 [caption_id] => 3 [1] => width [caption_name] => width [2] => 6 [unit_id] => 6 [3] => ft. [unit_option] => ft. ) [10] => Array ( [0] => 4 [caption_id] => 4 [1] => height [caption_name] => height [2] => 5 [unit_id] => 5 [3] => in. [unit_option] => in. ) [11] => Array ( [0] => 4 [caption_id] => 4 [1] => height [caption_name] => height [2] => 4 [unit_id] => 4 [3] => cm. [unit_option] => cm. ) [12] => Array ( [0] => 4 [caption_id] => 4 [1] => height [caption_name] => height [2] => 7 [unit_id] => 7 [3] => m. [unit_option] => m. ) [13] => Array ( [0] => 4 [caption_id] => 4 [1] => height [caption_name] => height [2] => 6 [unit_id] => 6 [3] => ft. [unit_option] => ft. ) [14] => Array ( [0] => 5 [caption_id] => 5 [1] => depth [caption_name] => depth [2] => 5 [unit_id] => 5 [3] => in. [unit_option] => in. ) [15] => Array ( [0] => 5 [caption_id] => 5 [1] => depth [caption_name] => depth [2] => 4 [unit_id] => 4 [3] => cm. [unit_option] => cm. ) [16] => Array ( [0] => 5 [caption_id] => 5 [1] => depth [caption_name] => depth [2] => 7 [unit_id] => 7 [3] => m. [unit_option] => m. ) [17] => Array ( [0] => 5 [caption_id] => 5 [1] => depth [caption_name] => depth [2] => 6 [unit_id] => 6 [3] => ft. [unit_option] => ft. ) [18] => Array ( [0] => 7 [caption_id] => 7 [1] => quantity [caption_name] => quantity [2] => 10 [unit_id] => 10 [3] => count [unit_option] => count ) [19] => Array ( [0] => 7 [caption_id] => 7 [1] => quantity [caption_name] => quantity [2] => 9 [unit_id] => 9 [3] => dozen [unit_option] => dozen ) [20] => Array ( [0] => 6 [caption_id] => 6 [1] => price [caption_name] => price [2] => 8 [unit_id] => 8 [3] => USD [unit_option] => USD ) [21] => Array ( [0] => 6 [caption_id] => 6 [1] => price [caption_name] => price [2] => 14 [unit_id] => 14 [3] => Euro [unit_option] => Euro ) ) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php