The krsort() function in PHP sorts an associative array in ascending order based on its keys.
- FALSE
- TRUE
The correct option is 2. The krsort() function in PHP sorts an associative array in descending order based on its keys, not in ascending order. It rearranges the elements of the array in such a way that the keys are sorted in descending order while maintaining the association between keys and values. The krsort() function directly modifies the original associative array. Sorting an associative array by keys in ascending order can be achieved using the ksort() function. Learn more: https://www.php.net/manual/en/function.krsort.php
Loading...
Related Quiz
- The $_POST superglobal in PHP is an associative array.
- You need to use the $this keyword in your PHP script. How would you do this?
- You are writing a PHP script and you need to fetch the content of a web page from a given URL. How would you do this using network functions?
- Which of the following are true about Form Handling in PHP?
- An array in PHP is a type of ______ data type.