Advertisement
ujiajah1

reverse_array

Aug 24th, 2016
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.40 KB | None | 0 0
  1. <html>
  2.     <p>
  3.     <?php
  4.     // Create an array with several elements in it,
  5.     // then sort it and print the joined elements to the screen
  6.     $the_array = array(1, 2, 3 ,4);
  7.     sort($the_array);
  8.     print join(", ", $the_array);
  9.     ?>
  10.     </p>
  11.     <p>
  12.     <?php
  13.     // Reverse sort your array and print the joined elements to the screen
  14.     rsort($the_array);
  15.     print join(", ", $the_array);
  16.     ?>
  17.     </p>
  18. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement