7. Array Functions II


#1

<?php
// Create an array with several elements in it,
// then sort it and print the joined elements to the screen
$the_array = array("Fish ", "Mean", "Pie", "go");
sort($the_array);
print join(", ", $the_array);
?>

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

Why doesn't this work (Kinda stressed);


#2

hello,
maybe if you try with numbers inside the array function it will work

<p>
<?php
// Create an array with several elements in it,
// then sort it and print the joined elements to the screen
$the_array = array(1, 2, 4, 7, 9, 10);
sort($the_array);
print join(", ",$the_array);
?>
</p>
<p>
<?php
// Reverse sort your array and print the joined elements to the screen

rsort($the_array);
print join(",", $the_array);
?>

#3

Words work fine. I passed with this example...

    <p>
    <?php
    // Create an array with several elements in it,
    // then sort it and print the joined elements to the screen
    $myList = array("This","is","an","array","of","words","in","a","sentence",".");
    sort($myList);
    print join(", ",$myList);
    ?>
    </p>
    <p>
    <?php
    // Reverse sort your array and print the joined elements to the screen
    rsort($myList);
    print join(", ",$myList);
    ?>
    </p>

It even passes with your exact code tacked on the end. Difficult to say what the problem might be.


#4

It's the small stuff that gets to me.

In the first example shown in the exercise, they have (", ", $array);
but in the second they have (":", $array).

Then, in the code that works, it's flipped. Why the colon? Why the space? When I change those, my code doesn't work. Why is it shown the opposite way in the way it's outlined in the examples???


#5