How can I reverse sort an array keeping the correlation
between the index and value?
Answers were Sorted based on User's Feedback
Answer / 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 |
What are the advantages of indexes in php?
Can you convert php to html?
Is php open source?
What is the difference between Reply-to and Return-path in the headers of a mail function?
Why do we use interface in php?
Is empty in php?
Does php 7 support multiple inheritance?
What does the function get_magic_quotes_gpc() means?
Tell me what are the functions to be used to get the image's properties (size, width and height)?
Write a program to find a string is palindrome or not?
What is the difference between PHP,ASP and JSP?
How to convert strings to numbers in php?