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.

The \$numbers array in the code below contains one thousand numbers. I need to count how many of th

Seems like no matter how many times I watch the videos I just do not understand a lot.. Not sure where else to go to learn the subject I am on. Do not see any other videos to watch on the part I am working on?

Hi Don,

What the code challenge is asking is how many numbers ar in each category. If you look at the code below I think you will understand what is being asked.

Jeff

```<?php

foreach (\$numbers as \$number) {
if(\$number < 1) {
\$count_less_than_one += 1;
}

if(\$number >= 1 && \$number <= 1000) {
\$count_between_one_and_thousand += 1;
}

if(\$number > 1000) {
\$count_greater_than_thousand += 1;
}
}

?>
```

The `foreach` loop lets you look at each number in the array one at a time, so you'll have to wrap those lines that add one to the count variables in `if` blocks so that only the numbers that match the criteria will be counted for each one.

Thank you been trying different if blocks on the preview they will show an error. Guess my real point is I need to learn what the test question is asking and going beck through the videos I still do not understand what to do on the question. Looked through the library to find a php video such as arrays etc, to learn more on the subject of the test question. Find nothing and gets to frustrating.

Thank you your code just passed, I wrote the same code and did not pass than I added =\$number +=1 which made no sense to me but tried anyway. Posted another time with a response with the same code which did not pass yet just posted your code and passed. I do not know what I am doing wrong, This has happened to me before.

Thank you again it did pass.