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

Arrays Forum

View Course » View Exercise

1936 points
6eb8c0ea0ebbdec581a8d7d14bf4e1da?s=140&d=retro
Submitted by
cvessel
over 4 years ago

Unset: Does index not start at 0?

Removing Python from the list required unset($languages[3]), though by index rules, shouldn't it be [2]? Maybe I missed something.


2 votes

permalink

the array is as following:
array("HTML/CSS", "JavaScript", "PHP", "Python", "Ruby")

So to remove Python is to unset($languages[3]), which is technically the FOURTH item in the array when counting normally. Maybe you missed the HTML/CSS array item?

692 points
50c8aa845f1c4c93f200652a_924031435
Submitted by
excowboy
over 4 years ago

1 Comment

51fb4880548c35db030019c3_164250221 Joel over 4 years ago

That's what happened to me. It was on a separate line that I wasn't looking at. It took me a while to figure out. I came here to see if anyone else had the same problem! :)