Created
August 12, 2014 07:33
-
-
Save JacobHsu/5805ac20aef534bfc85c to your computer and use it in GitHub Desktop.
#php : rsort , join
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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