Array Functions II


#1


https://www.codecademy.com/en/courses/web-beginner-en-7I7Xm/0/7


Can somebody help me ?
I got this error message :

"Oops, try again. Your reverse sorted array should have at least 3 elements in it. Make sure to pass a comma as the first argument to join() !"

while it appears correct on the screen:
1, 3, 5, 7

7: 5: 3: 1

<p>
	<?php
	// Create an array with several elements in it,
	// then sort it and print the joined elements to the scree
	$the_array = array(5, 3, 7, 1);
    sort($the_array);
    print join(", ", $the_array);
	?>
	</p>
	<p>
	<?php
	// Reverse sort your array and print the joined elements to the screen
    $the_array = array(5, 3, 7, 1);
    rsort($the_array);
    print join(": ", $the_array);
	?>
	</p>


#2

same problem here :frowning:


#3

print join(": ", $the_array);

you should've , instead :


#4

I turned print join(": ", $the_array); into print join(", ", $the_array); and it worked


#5

If you've any problem then you can create your own topic :slight_smile:

Don't know how to do this? Follow this link


#6

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.