How to sort array in ascending order with PHP

1 Answer

0 votes
$arr = array(5, 0, 7, 3, 2, 4);
 
sort($arr);
 
print_r($arr);



/*
run:

Array
(
    [0] => 0
    [1] => 2
    [2] => 3
    [3] => 4
    [4] => 5
    [5] => 7
)

*/

 



answered Aug 4, 2021 by avibootz

Related questions

...