Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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


Please Help Members By Posting Answers For Below Questions

What is a http session?

923


How can we destroy the cookie in php?

941


Which php framework is best?

945


What are the differences between GET and POST methods?

1019


Tell me is it possible to protect special characters in a query string?

869


How many keywords are there in php?

1088


Is null check in php?

958


How to remove an empty directory?

1005


Explain the difference between php4 and php5.

952


What are the difference between abstract class and interface in oops?

959


What are php magic methods/functions?

964


Explain a resource?

963


What are the delimiters in php?

936


How to select a database in php?

1034


Which library is used in php to do various types of image work?

958