Question #63
Submitted by Answiki
on 06/11/2020 at 12:05:14 PM UTC
How to sort PHP arrays?
Merged questions
Answer
Submitted by Answiki
on 09/19/2021 at 09:17:55 AM UTC
There are many ways to sort PHP arrays:
Sort by values:
Sort by keys:
Sort by user-defined function:
-
uasort()
: sort by values ⬈ -
uksort()
: sort by keys ⬈ -
usort()
: sort by values (do not maintain key association) ⬈
Multidimensional arrays:
-
array_multisort()
⬈
Full reference here : https://www.php.net/manual/en/array.sorting.php
Answer by Answiki on 09/19/2021 at 09:17:55 AM
There are many ways to sort PHP arrays:
Sort by values:
Sort by keys:
Sort by user-defined function:
-
uasort()
: sort by values ⬈ -
uksort()
: sort by keys ⬈ -
usort()
: sort by values (do not maintain key association) ⬈
Multidimensional arrays:
-
array_multisort()
⬈
Full reference here : https://www.php.net/manual/en/array.sorting.php
Answer by Answiki on 06/11/2020 at 01:23:06 PM
There is different ways to sort PHP arrays:
Sort by values:
Sort by keys:
Sort by user-defined function:
-
uasort()
: sort by values ⬈ -
uksort()
: sort by keys ⬈ -
usort()
: sort by values (do not maintain key association) ⬈
Multidimensional arrays:
-
array_multisort()
⬈
Full reference here : https://www.php.net/manual/en/array.sorting.php
Answer by Answiki on 06/11/2020 at 12:18:50 PM
Question by Answiki 06/11/2020 at 12:05:14 PM
How to sort PHP arrays?
# | ID | Query | URL | Count |
---|
Icons proudly provided by Friconix.