7 help!


#1

what am i doing wrong




<?php
// Create an array with several elements in it,
// then sort it and print the joined elements to the screen
$numbers = array(5, 15, 20, 25, 30, 35);
sort($numbers);
print join(",", $numbers);
?>

<?php
// Reverse sort your array and print the joined elements to the screen
$numbers = array(5, 15, 20, 25, 30, 35);
rsort($numbers);
print join(",", $numbers);
?>

</p>
</p>


#2

This is my code so allow me to try an explain. Please don't just copy and paste.
(I'm no expert so if I explain something wrong please correct me guys)

  1. I didn't sort $numbers instead I tried to sort the array itself.
  2. You don't need the array again for the reverse
  3. It seems you also used print and I used echo instead.
  4. Just try and edit your code while looking at this. I'd like it if you could just look and go off it by yourself.
  5. You are missing a lot of key components like


<p>
    <?php
        $the_array = array("1","3","4","2");
        sort($the_array);
        echo "sorted array: " . join(",",$the_array);;
    ?>
</p>


<p>
    <?php
        rsort($the_array);
        echo "<br> reversed sorted array: " . join(",",$the_array);

    ?>  
</p>
</div>