sort()
function is given with:sort()
function accepts the following parameters.
Parameter
|
Description
|
---|---|
array
|
Required. Specifies the array to sort.
|
sort_flags
|
Optional. Specifies how array items should be compared. Possible values are:
|
Output :
Array
(
[0] => Designing
[1] => House
[2] => Online
[3] => Promotion
[4] => Web
)
Example2 : following example sorts an indexed array having numeric values in ascending order
Output :
Array
(
[0] => 2
[1] => 5
[2] => 6
[3] => 8
)