Skip to content

Instantly share code, notes, and snippets.

@JacobHsu
Created August 12, 2014 07:33
Show Gist options
  • Save JacobHsu/5805ac20aef534bfc85c to your computer and use it in GitHub Desktop.
Save JacobHsu/5805ac20aef534bfc85c to your computer and use it in GitHub Desktop.
#php : rsort , join
<html>
<p>
<?php
// Create an array with several elements in it,
// then sort it and print the joined elements to the screen
$array = array(5, 3, 7, 1);
sort($array);
print join(", ", $array);
?>
</p>
<p>
<?php
// Reverse sort your array and print the joined elements to the screen
rsort($array);
print join(", ", $array);
?>
</p>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment