Hi!
I have an array that I want to sort...
The array consist of one main-array woth sub-arrays.
The main array contains number and each number is owner of a sub array.
In this example the main array has these values:
183947, 14415, 146530
Which each ha an array of the keys: [STR], [UNIT], [PACKAGE], [NAME]
When I use the print_r command it outputs this:
Array( [183947] => Array ( [STR] => 21 [UNIT] => stk [PACKAGE] => Blisterpakning [NAME] => C FLAGYL 200 mg Tablett [FORM] => Tablett, filmdrasjert ) [14415] => Array ( [STR] => 100 [UNIT] => ml [PACKAGE] => Flaske [NAME] => A FLAGYL 40 mg/ml Mikstur [FORM] => Mikstur, suspensjon ) [146530] => Array ( [STR] => 10 [UNIT] => stk [PACKAGE] => Blisterpakning [NAME] => B FLAGYL 400 mg Tablett [FORM] => Tablett, filmdrasjert )
I now want to sort the array by the contents of [NAME], is there a way to do this? The wanted output should then be like this:
Array( [14415] => Array ( [STR] => 100 [UNIT] => ml [PACKAGE] => Flaske [NAME] => A FLAGYL 40 mg/ml Mikstur [FORM] => Mikstur, suspensjon ) [146530] => Array ( [STR] => 10 [UNIT] => stk [PACKAGE] => Blisterpakning [NAME] => B FLAGYL 400 mg Tablett [FORM] => Tablett, filmdrasjert )
[183947] => Array ( [STR] => 21 [UNIT] => stk [PACKAGE] => Blisterpakning [NAME] => C FLAGYL 200 mg Tablett [FORM] => Tablett, filmdrasjert )
In advance thanks!
Paal
Pål Nesteby
PDC-Tangen
Norway
I have an array that I want to sort...
The array consist of one main-array woth sub-arrays.
The main array contains number and each number is owner of a sub array.
In this example the main array has these values:
183947, 14415, 146530
Which each ha an array of the keys: [STR], [UNIT], [PACKAGE], [NAME]
When I use the print_r command it outputs this:
Array( [183947] => Array ( [STR] => 21 [UNIT] => stk [PACKAGE] => Blisterpakning [NAME] => C FLAGYL 200 mg Tablett [FORM] => Tablett, filmdrasjert ) [14415] => Array ( [STR] => 100 [UNIT] => ml [PACKAGE] => Flaske [NAME] => A FLAGYL 40 mg/ml Mikstur [FORM] => Mikstur, suspensjon ) [146530] => Array ( [STR] => 10 [UNIT] => stk [PACKAGE] => Blisterpakning [NAME] => B FLAGYL 400 mg Tablett [FORM] => Tablett, filmdrasjert )
I now want to sort the array by the contents of [NAME], is there a way to do this? The wanted output should then be like this:
Array( [14415] => Array ( [STR] => 100 [UNIT] => ml [PACKAGE] => Flaske [NAME] => A FLAGYL 40 mg/ml Mikstur [FORM] => Mikstur, suspensjon ) [146530] => Array ( [STR] => 10 [UNIT] => stk [PACKAGE] => Blisterpakning [NAME] => B FLAGYL 400 mg Tablett [FORM] => Tablett, filmdrasjert )
[183947] => Array ( [STR] => 21 [UNIT] => stk [PACKAGE] => Blisterpakning [NAME] => C FLAGYL 200 mg Tablett [FORM] => Tablett, filmdrasjert )
In advance thanks!
Paal
Pål Nesteby
PDC-Tangen
Norway