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
Why php is widely used?
What are the methods of array in java?
How does html form submit work?
What are the encryption functions in php?
What are php strings?
What are the characteristics of php variables?
What does namespace mean in php?
What is crypt () in php?
armstrong number by using php while number is given by the keyboard.?
What is the use of mysql_real_escape_string in php?
What is baseurl?
Which php framework is fastest?
What is csrf cookie?
How to call a php function from html button?
What is the difference between query and inquiry?