Array Functions II - an error on the site


#1

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

When i write

$countries = array('Romania', 'UK', 'Spain', 'US', 'Russia');
sort($countries);
print join(",", $countries);


$countries = array('Romania', 'UK', 'Spain', 'US', 'Russia');
rsort($countries);
print join(",", $countries);

or

$countries = array('Romania', 'UK', 'Spain', 'US', 'Russia');
sort($countries);
print join(",", $countries);


rsort($countries);
print join(",", $countries);

I see this error: Your reverse sorted array should have at least 3 elements in it. Make sure to pass a comma as the first argument to join() !

How to move to the next level?


#2

Understood method scientific. It works like this:

<html>
    <p>
    <?php
    // Create an array with several elements in it,
    // then sort it and print the joined elements to the screen
    $the_array = array(5, 3, 7);
    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);
    rsort($the_array);
    print join(", ", $the_array);
    ?>
    </p>
</html>

#3

$array = array(5, 3, 7 ,1);
rsort($array);
print join(":", $array);
Change print join(",", $array);

print join(":", $array); not correct