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

Functions, Part I Forum

View Course » View Exercise

93 points
63c1e262e228e0d7ae324e1a0bf5f04d?s=140&d=retro
Submitted by
BruteLogic_53bdf81780ff33e92a00052b_
about 3 years ago

Help with my code?

I'm supposed to sort and rsort the array but when i click sumbmit it says make sure your rsort has at least three elements in them? My code:

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


<?php
// Reverse sort your array and print the joined elements to the screen
$the
array = array(7,1,4,2,5,3,6);
rsort($thearray);
print join (":", $the
array);
?>


2 votes

permalink

Hello, on the line:

print join(":", $the_array);

use "," instead of ":", that is, use a comma instead of a colon.

Please make the suggested modification and refresh the web page.

6455 points
52def2869c4e9d5f55000716_359294020
Submitted by
Gabriel La Rotta
about 3 years ago

1 Comment

63c1e262e228e0d7ae324e1a0bf5f04d?s=140&d=retro BruteLogic_53bdf81780ff33e92a00052b_ about 3 years ago

Thank you so much, in the example it used a colon that's why I used it and it never came to my mind to change it to a comma