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

Functions, Part I Forum

View Course » View Exercise

219 points
52c716cefd4acfeccc78429e85d4b52f?s=140&d=retro
Submitted by
Hossam.Zidan87
almost 2 years ago

7/8

plz help i can't pass this one i don't understand what shall i do
can you post the code plz


1 vote

permalink

I'm stuck too! The code is previewed flawlessly, but codeacademy says there's not enought items in the array...
btw, here is my code:
"

<?php
// Create an array with several elements in it,
// then sort it and print the joined elements to the screen
$array=array(1,9,4,3,5,6,7,8);
sort($array);
print join(", ",$array);
?>


<?php
// Reverse sort your array and print the joined elements to the screen
$arraye=array(1,9,4,3,5,6,7,8,9); /*arraye = a desesperate try to make the code be accepted */
rsort($arraye);
print join(":" , $arraye);
?>

"

109 points
3239b1b2013c5c5457c73491390d38b3?s=140&d=retro
Submitted by
multiskin
almost 2 years ago

1 Comment

52c716cefd4acfeccc78429e85d4b52f?s=140&d=retro Hossam.Zidan87 almost 2 years ago

i got it read my comment


1 vote

permalink

SOLUTION: DO A PRINT JOIN WITH "," AFTER RSORT...
OMG, THE STEP-BY-STEP DOES NOT SAYS WHAT KIND OF JOIN YOU HAVE TO DO...
BUT IT'S SO LAME THAT THE CODE IS NOT ACCEPTED AND EVEN SHOW A MESSAGE THAT DOESN'T HAVE ANYTHING TO DO WITH THE REAL ERROR

109 points
3239b1b2013c5c5457c73491390d38b3?s=140&d=retro
Submitted by
multiskin
almost 2 years ago


1 vote

permalink

**

I GOT IT wahahahaha

**

<?php
// Create an array with several elements in it,
// then sort it and print the joined elements to the screen
$thearray = array(6,8,7,9,1);
sort($the
array);
print join(",",$the_array);
?>


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

rsort($thearray);
print join(",", $the
array);
?>

219 points
52c716cefd4acfeccc78429e85d4b52f?s=140&d=retro
Submitted by
Hossam.Zidan87
almost 2 years ago