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?
CodePudding user response:
Try:
$result = $commonTitles->merge($newTitles)->sort(SORT_NATURAL | SORT_FLAG_CASE);