PHP Questions Home

Categories

Arrays
Files
Forms
Functions
Images
MySQL
Numbers
Others
Strings
Website


PHP Functions

PHP Functions


More PHP

Top Questions
Ask a Question

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
)



More arrays PHP Questions

How do I write my own sort function?
How do I remove and view the last element of an array?
How can I sort an array keeping the correlation between the index and value?
How do I add to the beginning of an array and find the number of elements in it?
How do I find out if a value is already in an array?