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 are the difference between overloading and overriding in oops?

960


What is singleton class in php?

938


What are the 3 scope levels available in php and how would you define them?

917


How does the identity operator === compare two values?

1070


How check submit button is clicked in php?

939


How can we connect to a mysql database from a php script?

1040


List some features of php that are deprecated in php

874


How to reset/destroy a cookie in php?

922


Php error constants and their descriptions

1100


How is the ternary conditional operator used in php?

954


How to return ascii value of character in php?

1058


What is the advantage of runtime polymorphism?

884


Can we extend multiple classes in php?

981


hello all, I need some sample placement papers in lion bridge.. can anyone help me?

2003


What does nan stand for computer science?

907