Merge two arrays and sort them as numbers, in descending order:


SUBMITTED BY: henry1874w

DATE: June 25, 2017, 2:32 p.m.

FORMAT: Text only

SIZE: 153 Bytes

HITS: 278

  1. <?php
  2. $a1=array(1,30,15,7,25);
  3. $a2=array(4,30,20,41,66);
  4. $num=array_merge($a1,$a2);
  5. array_multisort($num,SORT_DESC,SORT_NUMERIC);
  6. print_r($num);
  7. ?>

comments powered by Disqus