Sort And Searching Question:
Explain which of the following is true about asort?
• Sorts highest to lowest by value maintaining key association.
• Sorts lowest to highest by key maintaining key association.
• Sorts highest to lowest by key, re-indexing the array.
• Sorts lowest to highest by value, re-indexing the array.

Answer:
Sorts lowest to highest by key maintaining key association.
asort()
This function sorts an array such that array indices
maintain their correlation with the array elements they are
associated with. This is used mainly when sorting
associative arrays where the actual element order is
significant.
asort()
This function sorts an array such that array indices
maintain their correlation with the array elements they are
associated with. This is used mainly when sorting
associative arrays where the actual element order is
significant.
Previous Question | Next Question |
How to sort 1 million floating point numbers? | Tell me which of the following maintain index associations? • ksort • asort • sort |