-2

Suppose I have an array like that

$test= array(5,4,8,9,3,7,2,10,1);

Now I'll print them

foreach($test as $key => $value){           
    echo "<ul><li>$value</li></ul>";
}

but I want my output will be all numbers showing serially like

1
2
3
4
5
7
8
9
10

then how ill filter them and how can I get that kind of output?

Barmar
  • 741,623
  • 53
  • 500
  • 612

1 Answers1

0

This shows how to sort:

  <ul>
  <?php
    $test= array(5,4,8,9,3,7,2,10,1);
    sort($test);
    foreach($test as $key => $value){           
      echo "<li>$value</li>";
    }
  ?>
  </ul>
user3425506
  • 1,285
  • 1
  • 16
  • 26