note 124044 deleted from function.array-multisort by cmb
| From: | cmb@php.net | Date: | Wed, 17 Jul 2019 14:47:22 +0000 |
| Subject: | note 124044 deleted from function.array-multisort by cmb | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-211613@lists.php.net to get a copy of this message | ||
Note Submitter: p dot sims at thedotfactory dot co dot uk
----
How to use SORT_FLAG_CASE
I had been trying to sort a column of names alphabetically
but noticed that the sorting would go A-Z then a-z leaving any lowercase names at the end of the
array.
I wrongly passed SORT_FLAG_CASE as an extra parameter which did not work!!
the only way I got this to work was to pass it with the sort flag param separated by | (pipe) for
example
<?php
array_multisort($column, SORT_ASC, SORT_NATURAL | SORT_FLAG_CASE, $data);
?>
This gave me case insensitive A-Z sorting. Hope this helps