php - How to sort an empty array? -


how sort empty array using foreach loop output these 25 numbers in order?

example outcome be: 1 1 1 1 1 2 2 2 2 3 3 3 3 3 4 4 4 4

    <?php     $array = array();      for($counter = 0; $counter <=25; $counter++){          $die = rand(1, 10);         $int[$counter] = $die;              echo " $die ";       }      sort($die);     foreach ($die $value)      {        echo '<option value="'.$value.'">'.$value.'</option>';     }     ?> 

<?php $array = array(); ($i = 0; $i <=25; $i++) {     echo $array[] = rand(1, 10); }  sort($array); foreach ($array $value) {     echo '<option value="'.$value.'">'.$value.'</option>';  } 

Comments

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -