PHP Questions Home | Register | Login
Categories
Arrays
Files
Forms
Creating PDFs
PHP Errors
Functions
Images
MySQL
Numbers
Others
Strings
Website
Unanswered

PHP Forums
Forums Index
MySQL Forum
PHP Forum
Flash/Actionscript
Javascript
Web design

More PHP
PHP Functions
Top Questions
Ask a Question
PHP Interview Questions
PHP Jobs
Ecommerce
IT Questions
Business Websites

Sponsors

sponsor ad
My Salary
PHP Developer Salary
Advertise Here

How can I reverse sort an array keeping the correlation between the index and value?


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
)



Comment on this Question and Answer >>>

ASK A QUESTION

More arrays PHP Questions

Hi. i have a music samples website. in one table, id like a different sample to appear every time the page is refreshed. how do i acheve this? how can i alterate and retrieve these bloody mp3's? surely i can use a PHP script? thankyou

How do I find if a value is already in an array or not?

How can I easily view all members of an array?

How can I mix up the order of values in an array?

How do I change: function wordlimit($string, $length = 50, $ellipsis = "...") { $words = explode(' ', strip_tags($string)); if (count($words) > $length) return implode(' ', array_slice($words, 0, $length)) . $ellipsis; else



Custom Search