This forum is now read-only. Please use our new forums! Go to forums
Solution for Array Functions II 8/8
This is my solution.
<html>
<p>
<?php
// Create an array with several elements in it,
// then sort it and print the joined elements to the screen
$thearray = array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
sort($thearray);
print join(",",$thearray);
?>
</p>
<p>
<?php
// Reverse sort your array and print the joined elements to the screen
print join(",", $thearray);
rsort($thearray);
print join(",", $thearray);
?>
</p>
</html>
Answer 550b025495e378199f003d78
3 votes
Try to resort your array first before printing again:
<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 ,8 ,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>
Answer 550f03a176b8fe6fb2003abe
Popular free courses
- Free Course
Learn SQL
In this SQL course, you'll learn how to manage large datasets and analyze real data using the standard data management language.Beginner friendly,4 LessonsLanguage Fluency - Free Course
Learn JavaScript
Learn how to use JavaScript — a powerful and flexible programming language for adding website interactivity.Beginner friendly,11 LessonsLanguage Fluency - Free Course
Learn HTML
Start at the beginning by learning HTML basics — an important foundation for building and editing web pages.Beginner friendly,6 LessonsLanguage Fluency
1 comments
SO smart! Thank u so much!