I'm having trouble getting to re-arrange an array by the key's duplicate values of the Key 'Company' and making it the value so that it is re-arranged in the code below this one:
Original array:
$array = array(
'number' => 2,
'items' =>
array(
'Company' => 'ABC',
'First' => 'John',
'Last' => 'Doe',
),
array(
'Company' => 'ABC',
'First' => 'Jane',
'Last' => 'Doe',
),
array(
'Company' => 'XYZ',
'First' => 'Peter',
'Last' => 'Pumpkin',
),
);
I want to re-sort the array on the 'Company' value and make it the key, like the example below:
$array = array(
'number' => 2,
'items' =>
array(
'ABC' =>
array(
'First' => 'John',
'Last' => 'Doe'),
array(
'First' => 'Jane',
'Last' => 'Doe'),
'XYZ' =>
array(
'First' => 'Peter',
'Last' => 'Pumpkin'),
)
);
I looked hard in the PHP Docs, so this seems to be a unique type of sort.