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
What are the different errors in php?
What is the output of the following php code?
How to retrieve the original query string?
What sized websites have you worked on in the past?
How arrays are passed through arguments?
How to create and destroy cookies in php?
Do you know what are traits?
How can you send email in php?
can we swap two different string using php for example:-- before swapping:-- 1 string :-hello friend, 2 string :-my dear, after swapping that strings will be: 1.hello dear, 2.my friend.
What is csrf token and how will you add csrf token in ajax?
How to increase the maximum execution time of a script in php?
Explain Type hinting in PHP?
How do you identify independent and dependent variables in research?
Which function can be used to delete a file?
Where are cookies stored php?