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 is a composer in PHP?
Questions on OOP concepts 1. What are the access specifiers available in php ? Explain 2. What is object cloning ? 3. What are the differences between interface and abstract class ? 4. What is overloading ? 5. What is overriding ? 6. How to prevent function overriding ? 7. What is the use of "final" keyword ? 8. What is static variable ? How will access a static variable ? What is static class ?
How to block direct directory access in PHP?
What is difference between action hook and filter hook?
How can image properties be retrieved in php?
What are new features in php 7?
What is the difference between substr() and strstr()?
How can we set and destroy the cookie in php?
What is the use of mysql_real_escape_string() function?
What is artisan in php?
armstrong number by using php while number is given by the keyboard.?
Is multiple inheritance supported in php?