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
Tell me what types of loops exist in php?
How to access a Static Member of a Class in PHP?
What is the difference between runtime exception and compile time exception?
What is the difference between query and inquiry?
What is default session time in php?
How does php work?
What is the difference between print() and echo()?
How to protect special characters in query string?
Is age interval or ordinal data?
How to create a table to store files?
How cookies are transported from browsers to servers?
How to reset/destroy a cookie?
Tell me what is the main difference between require() and require_once()?
Which function is used to read a file removing the html and php tags in it upwork?
Tell me what is mean by an associative array?