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

Control Flow: Switch Forum

View Course

143 points
5605557d9113cba113000166_519261121
Submitted by
Carmen Buta
about 2 years ago

I need to delete Phyton from the array, why is not working?

I am pretty sure that I am doing it right, but I still can't pass to the next level. What did I do wrong?

Modifying Elements



<?php
$languages = array("HTML/CSS",
"JavaScript", "PHP", "Python", "Ruby");
// Write the code to remove Python here!

    unset($languages[2]);

    // Write your code above this line. Don't
    // worry about the code below just yet; we're
    // using it to print the new array out for you!

    foreach($languages as $lang) {
      print "<p>$lang</p>";
    }
  ?>
</p>

0 votes

permalink

array(0 "HTML/CSS", 1 "JavaScript", 2 "PHP",3 "Python", 4 "Ruby");

Change unset($languages[2]); in unset($languages[3]);

1409 points
588b2ac3e1281365f0000133_918398059
Submitted by
Codmakr
about 2 years ago

1 Comment

5605557d9113cba113000166_519261121 Carmen Buta about 2 years ago

Thanks! :)