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 |
Tell me how to find the position of the first occurrence of a substring in a string?
How to create database connection and query in php?
How will you create a bi-lingual site (multiple languages) ?
How to delete an element from an array?
Which operator is used to concatenate two strings in PHP?
List types of array are available in php?
What is trim function in php?
What are new features in php 7?
what is array_search() in php?
How to create the PHP Script to Calculate the Age Using the Inputs Of our Birth date and the Current date?
What is the difference between unlink and unset ?
Is php an api?