This forum is now read-only. Please use our new forums at discuss.codecademy.com.

Functions, Part I Forum

View Course » View Exercise

1153 points
55012641e39efe413300215b_278863659
Submitted by
Shaylee Wheatley Hansen
about 2 years ago

This is correct. Won't let me pass. Says reversed array should have at least three elements

<?php
// Create an array with several elements in it,
// then sort it and print the joined elements to the screen
$thearray = array(8,0,1,7);
sort($the
array);
print join(", ", $thearray);
?>


<?php
// Reverse sort your array and print the joined elements to the scr rsort($the
array);
rsort($thearray);
print join(":", $the
array);
?>


3 votes

permalink

your second part to print join(":", $thearray); it says to join glue using a comma
so it should read print join(", ", $the
array);
it worked for me... good luck!

182 points
5440a24bc78f83001a860c78c2bd2a0a?s=140&d=retro
Submitted by
angel_justice
about 2 years ago

3 Comments

53f8a98b7c82caae510043f6_674058757 Thermidor about 2 years ago

that's right use a comma in the 2nd join. Even though the example has colon instead.

6f4e51b26ab9cfb8cdc35c8ca2ccbb9a?s=140&d=retro wolflover12354 almost 2 years ago

hi, I tried this and it did not work

55711689d3292f1d340000fd_43574267 ger almost 2 years ago

I had the same issue today and I realise that the problem is that I put the sort() and rsort() under the same <?php ... ?> tag. Once I moved the rsort() to the second <?php ... ?>, it worked.


0 votes

permalink

i'm having the same problem i need help

547 points
55e7642086f55250390004dc_31640069
Submitted by
MissPotato201
about 2 years ago


0 votes

permalink

i tried what angel_justice said and it worked thanks!!

547 points
55e7642086f55250390004dc_31640069
Submitted by
MissPotato201
about 2 years ago