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
Explain the difference between static and dynamic websites?
What is the use of header in php?
Which function is used in php to search a particular value in an array?
Tell me how can we automatically escape incoming data?
What are the features and advantages of object-oriented programming in php?
What does explode do in php?
List functions available to sort an php array?
How check submit button is clicked in php?
What do you mean by having php as whitespace insensitive?
What is the difference between print() and echo() in PHP?
What is php built on?
What are html entities?
What is the role of php?
How can you declare a constant variable in php?
How to create a table to store files?