How can I reverse sort an array keeping the correlation
between the index and value?
Answer Posted / amit
<?php
$fruits = array("d" => "lemon", "a" => "orange", "b" =>
"banana", "c" => "apple");
arsort($fruits);
foreach ($fruits as $key => $val) {
echo "$key = $val\n";
}
?>
OUTPUT
a = orange
d = lemon
b = banana
c = apple
| Is This Answer Correct ? | 6 Yes | 0 No |
Post New Answer View All Answers
What are the difference between overloading and overriding in oops?
What is singleton class in php?
What are the 3 scope levels available in php and how would you define them?
How does the identity operator === compare two values?
How check submit button is clicked in php?
How can we connect to a mysql database from a php script?
List some features of php that are deprecated in php
How to reset/destroy a cookie in php?
Php error constants and their descriptions
How is the ternary conditional operator used in php?
How to return ascii value of character in php?
What is the advantage of runtime polymorphism?
Can we extend multiple classes in php?
hello all, I need some sample placement papers in lion bridge.. can anyone help me?
What does nan stand for computer science?