我在 laravel 中有以下集合:
Collection {#357 ▼
#items: array:11 [▼
"29-04-2016" => array:2 [▼
"posTotal" => "100"
"posCount" => 1
]
"05-05-2016" => array:6 [▼
"posTotal" => "11"
"posCount" => 1
"keyedTotal" => "120"
"keyedCount" => 1
"cashTotal" => "32"
"cashCount" => 2
]
"10-05-2016" => array:10 [▼
"posTotal" => "67"
"posCount" => 4
"keyedTotal" => "22"
"keyedCount" => 1
"cashcardTotal" => "123"
"cashcardCount" => 1
"refundTotal" => "-50"
"refundCount" => 1
"cashRefundTotal" => "-10"
"cashRefundCount" => 1
]
"17-05-2016" => array:2 [▶]
"06-05-2016" => array:2 [▶]
"16-05-2016" => array:2 [▶]
"22-04-2016" => array:2 [▶]
"25-04-2016" => array:2 [▶]
]
}
现在我想按索引对其进行排序,但需要根据日期对其进行转换。
例如,我想展示
"17-05-2016" => array:2 [▶]
"10-05-2016" => array:10 [▶]
"06-05-2016" => array:2 [▶]
等等...
我尝试了 laravel 的排序集合方法,也尝试了 php 的 ksort 函数将集合转换为数组。但它把它当作一个字符串。