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
How we get browser details of clients machine?
What is the difference between explode() and split() functions?
What is faster in php?
what is constructor
How variables are passed through arguments?
How to submit form without a submit button.
Which software is best for php?
Is php used for frontend or backend?
What is the difference between get & post ?
Does php have block scope?
How to remove duplicate values from a PHP Array?
What are different types of Print Functions available in PHP?
Does cors prevent csrf?
What is action hooks and filter hooks?
What is php built on?