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

Functions, Part I Forum

View Course » View Exercise

366 points
1c9a7f08c14ec0dedcaea2648f3e6f0e?s=140&d=retro
Submitted by
Ghost King
over 2 years ago

I don't know how to Repair!!!

<html>
    <p>
<?php
// Create an array with several elements in it,
// then sort it and print the joined elements to the screen
$thearray = array(7,5,9,10,15);
sort($thearray);
print join(", ",$thearray);
?>
<p>
</P>
<?php
// Reverse sort your array and print the joined elements to //the screen
$thearray = array(7,10,15);
rsort($thearray);
print join(":", $thearray);
?>
    </p>
</html>

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() !


0 votes

permalink

I believe your problem is in the reverse sort section. Even though you are in a new section, the same variables still work and do not have to be called again. So in that case, you do not need to call '$thearray = array(7,10,15);' All you need to do is delete it. Your code should look like this:

'

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


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

'

Hope this helps!!

491 points
Ce287283c91c0e829fad6beb3905dd70?s=140&d=retro
Submitted by
enduffy2014
over 2 years ago

1 Comment

1c9a7f08c14ec0dedcaea2648f3e6f0e?s=140&d=retro Ghost King over 2 years ago

OK ><