Advertisement
nikolaysimeonov

2nd 03.Sort numbers

Jun 21st, 2014
274
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.64 KB | None | 0 0
  1. <?php
  2. echo "Sort number 10, 1, 69 <br/>";
  3. $numbers=array(10, 1, 69);
  4. sort($numbers, SORT_NUMERIC);
  5. foreach($numbers as $value){
  6. echo $value."<br/>";
  7. }
  8.  
  9. /*
  10. SORT_REGULAR - compare items normally (don't change types)
  11. SORT_NUMERIC - compare items numerically
  12. SORT_STRING - compare items as strings
  13. SORT_LOCALE_STRING - compare items as strings, based on the current locale.
  14.                     It uses the locale, which can be changed using setlocale()
  15. SORT_NATURAL - compare items as strings using "natural ordering" like natsort()
  16. SORT_FLAG_CASE - can be combined (bitwise OR) with SORT_STRING or
  17.                 SORT_NATURAL to sort strings case-insensitively
  18. */
  19.  
  20. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement