Reputation: 355
I want to sort two laravel
collection after merging them in alphabetical order, I've used the following code:
$result = $commonTitles->merge($newTitles)->sort();
And the result is sorted A to Z and then a to z.
["Ask","Black","Unit","ab","live","test"]
The result that I expect is sorting as A a to z Z. How can I change the result?
Upvotes: 0
Views: 188
Reputation: 355
Try:
$result = $commonTitles->merge($newTitles)->sort(SORT_NATURAL | SORT_FLAG_CASE);
Upvotes: 2