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

Arrays Forum

View Course » View Exercise

1414 points
1ed84ddd14f39314dc27ce39b263ca80?s=140&d=retro
Submitted by
ingolfsson
about 2 years ago

Delete Array Element 7/7 - is NOT bugged, solution inside.

I though that 7/7 was bugged, checked the Q/A and sure enough people complained about the same issue, after finding a way to make the code work I noticed something.. There are 5 elements in the languages array, not 4 as I originally though.

This is what I saw the first time
$languages = array("HTML/CSS",
"JavaScript", "PHP", "Python", "Ruby");
------[0]-----------[1]--------[2]-----------[3]

But I missed the first element ([0])
("HTML/CSS",

What it really looks like in a single line

$languages = array("HTML/CSS", "JavaScript", "PHP", "Python", "Ruby");
--------------------------------[0]--------------[1]------------[2]-------[3]-------------[4]

Remove python so you should be able to full up X now

unset($languages[X]);

Happy coding!


1 vote

permalink

this code is working on my side
I removed $array in the unset() and put the variable inside which $languages

$languages = array("HTML/CSS",
"JavaScript", "PHP", "Python", "Ruby");
// Write the code to remove Python here!
unset($languages[3]);

466 points
55b88ffa9113cb44e00003c3_865455376
Submitted by
Dini Gcolotela
almost 2 years ago

1 Comment

34c099750c03da76354b041970d9581c?s=140&d=retro Jace0 over 1 year ago

thanks this works


0 votes

permalink

That was a perfect explanation until X was introduced?

29 points
665ccc70b79780ce2fef767a623757b8?s=140&d=retro
Submitted by
ibrandy
almost 2 years ago

1 Comment

5674c6dae39efec455000434_879409444 Zeke Y almost 2 years ago

Seems like a great explanation to me. What's wrong with using the letter X?


0 votes

permalink

This exercise was absolutely bugged for me. Strangely, it only worked after I removed all the commented code.

1058 points
E4637eca88efa1a8e65a99a26349bf42?s=140&d=retro
Submitted by
TritoneJapan
almost 2 years ago