我有一个包含哈希的数组引用(即@AOH)
$arr_ref = [ { 'brand' => 'A',
'supplier' => 'X',
'PO' => '2'
},
{ 'brand' => 'B',
'supplier' => 'Y',
'PO' => '1'
},
{ 'brand' => 'B',
'supplier' => 'X',
'PO' => '2'
},
{ 'brand' => 'A',
'supplier' => 'X',
'PO' => '1'
},
{ 'brand' => 'B',
'supplier' => 'X',
'PO' => '1'
}
];
我想根据所有三个键(即品牌、供应商和采购订单)对其进行排序。排序顺序应该是先品牌,然后是供应商,最后是PO。
排序后的数组引用应该是:
$arr_ref = [ { 'brand' => 'A',
'supplier' => 'X',
'PO' => '1'
},
{ 'brand' => 'A',
'supplier' => 'X',
'PO' => '2'
},
{ 'brand' => 'B',
'supplier' => 'X',
'PO' => '1'
},
{ 'brand' => 'B',
'supplier' => 'X',
'PO' => '2'
},
{ 'brand' => 'B',
'supplier' => 'Y',
'PO' => '1'
},
];