Sort an array in ascending order in PHP

Description

The following code shows how to sort an array in ascending order.

Example


/*from   www  .  j a v a  2  s.  c  om*/
<?php
    $a=array("Dog","Cat","Horse","A","Z");
    array_multisort($a);
    print_r($a);
?>

The code above generates the following result.





















Home »
  PHP Tutorial »
    Data Types »




Array
Array Associative
Array Util
ArrayObject
Data Types
Date
Date Format
DateTime
Number
String
String Escape
String Filter
String HTML
String Type
Timezone