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

Functions, Part I Forum

View Course » View Exercise

231 points
Bbcba3034a7e167afbfccb14fe8afaee?s=140&d=retro
Submitted by
shemona singh
almost 2 years ago

Question for 7/8

I keep getting this error: 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() !

I think I know why I'm getting it, but how can I fix it? Here is my code:

<?php
// Create an array with several elements in it,
// then sort it and print the joined elements to the screen
$jungle = array(4, 6, 7, 8);

sort($jungle);

print join(",", $jungle);

rsort($jungle);

print join(",", $jungle);
?>


<?php
// Reverse sort your array and print the joined elements to the screen

?>
</p>

1 vote

permalink

here is my code. and success for me to the next lesson :

<?php
// Create an array with several elements in it,
// then sort it and print the joined elements to the screen
$thearray = array(101, 104, 102, 103);
sort($the
array);
print join(",", $thearray);
?>


<?php
// Reverse sort your array and print the joined elements to the screen
$the
array = array(101, 104, 102, 103);
rsort($thearray);
print join(",", $the
array);
?>

83 points
55d6d805d3292fb6f300071b_353203186
Submitted by
Asep Erlan Maulana
almost 2 years ago


0 votes

permalink

You need to make a array called $the_array .

657 points
868959d299d5fc95b7433b5c143ccd51?s=140&d=retro
Submitted by
Canfly
almost 2 years ago

1 Comment

Bbcba3034a7e167afbfccb14fe8afaee?s=140&d=retro shemona singh almost 2 years ago

i changed my array name to $the_array but I am still getting the same error