fork download
  1. <?php
  2. $a1=array(5,3,7);
  3. $a2=array(1,8,4);
  4. $n1=count($a1);
  5. $n2=count($a2);
  6. $a3=array();
  7. for($i=0;$i<$n1;$i++){
  8. $a3[$i]=$a1[$i];
  9. }
  10. for($i=$n1;$i<$n2+$n1;$i++){
  11. $a3[$i] = $a2[$i-$n2];
  12. }
  13. rsort($a3);
  14. $n3 = count($a3);
  15. echo "Sorted Merged List: ";
  16. for($x = 0; $x < $n3; $x++) {
  17. echo $a3[$x]," ";
  18. }
  19. ?>
Success #stdin #stdout 0.02s 26184KB
stdin
Standard input is empty
stdout
Sorted Merged List: 8 7 5 4 3 1