Jump to: navigation, search

Php arsort

From w3cyberlearnings

Contents

PHP function arsort

This function sorts array in reverse order by using the array's values.

Syntax arsort

  • array: array input
arsort(array);

Note

For function sorts without reverse order uses asort() function.

Example 1

<?php

$country = array(
	 'USA' => 80,
	 'CHINA' => 61,
	 'VIETNAME' => 434,
	 'INDIA' => 135
);
arsort($country);
print_r($country);
?>

Output

Array
(
    [VIETNAME] => 434
    [INDIA] => 135
    [USA] => 80
    [CHINA] => 61
)

Related Links


Navigation
Web
SQL
MISC
References