How can I reverse sort an array keeping the correlation
between the index and value?
Answer Posted / jude jeevanraj.p
This is done using the arsort function:
<?php
$myworld = array
("a"=>"everything","b"=>"nothing","c"=>"is");
arsort($myworld);
print_r($myworld);
?>
Which prints this:
Array
(
[b] => nothing
[c] => is
[a] => everything
)
Is This Answer Correct ? | 3 Yes | 6 No |
Post New Answer View All Answers
What is the main difference between php 4 and php 5?
Explain how can we increase the execution time of a php script?
What is the function mysql_pconnect() useful for?
Why do we need session?
Is PHP runs on different platforms (Windows, Linux, Unix, etc.)?
What is the difference between == and === in php?
Which array function checks if the particular key exists in the array?
What type of operation is needed when passing values through a form or an url?
How do I use isdigit function?
How do I check if a given variable is empty?
How do you destroy a particular or all Sessions?
Is strcmp case sensitive?
What is the php function that removes the last element of the array and returns it?
Why use php artisan serve?
What is difference between static and constant in php?