note 124044 added to function.array-multisort
| From: | p dot sims at thedotfactory dot co dot uk | Date: | Wed, 17 Jul 2019 14:09:05 +0000 |
| Subject: | note 124044 added to function.array-multisort | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-211612@lists.php.net to get a copy of this message | ||
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
----
Server IP: 208.43.231.9
Probable Submitter: 185.85.3.195 (proxied: 85.199.251.188)
----
Manual Page -- http://php.net/manual/en/function.array-multisort.php
Edit -- https://master.php.net/note/edit/124044
Del: integrated -- https://master.php.net/note/delete/124044/integrated
Del: useless -- https://master.php.net/note/delete/124044/useless
Del: bad code -- https://master.php.net/note/delete/124044/bad+code
Del: spam -- https://master.php.net/note/delete/124044/spam
Del: non-english -- https://master.php.net/note/delete/124044/non-english
Del: in docs -- https://master.php.net/note/delete/124044/in+docs
Del: other reasons-- https://master.php.net/note/delete/124044
Reject -- https://master.php.net/note/reject/124044
Search -- https://master.php.net/manage/user-notes.php