Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

PHP PHP Arrays and Control Structures PHP Arrays Associative Quiz

Arvelle Whitaker
Arvelle Whitaker
7,452 Points

Why is blue the second element and not the first?

I am a little confused. I know that position one in an array is "0" even though it is zero, would it still be referred to as the first element?

I kept choosing the answer Green because I start at zero and then Blue in my mind is the first element [ 1 ] then Green [ 2 ]. I think im getting the numbers and the verbage mixed up

1 Answer

Hey Arvelle,

you are right that in the world of programming, counting starts with the number 0, and that can indeed get confusing. However, the question asks which is the "second" element - don't confuse that with the element at position 2. In our every-day language we still say "first, second, third"; this also applies in programming. (Imagine if you'd say "zero-th", hehe).

So the first element is the element at position 0 ("Red"). The second element is the element at position 1 ("Blue"), etc.

Hope that helps.