Sort And Searching Question:

Download Job Interview Questions and Answers PDF

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.

Sort And Searching Interview Question
Sort And Searching Interview Question

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.

Download Sort And Searching Interview Questions And Answers PDF

Previous QuestionNext Question
How to sort 1 million floating point numbers?Tell me which of the following maintain index associations?

• ksort
• asort
• sort