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 trialAndrew mwendo
5,712 PointsQuiz Question 4 of 5 Please fill in the correct answer in each blank provided below
help
1 Answer
Benjamin Larson
34,055 PointsThat question probably needs more explanation--how to answer it is not that very obvious until you check the teacher's notes from the previous video:
Documentation
- each: returns the current key and value pair from an array and advance the array cursor.
- list: assigns variables as if they were an array.
Additional Examples
//increment before evaluating the $count variable
$count=0;
while ((list($key, $val) = each($todo)) && (++$count <= 2)) {
echo "$key => $val\n";
}
//increment after evaluating the $count variable
$count=1;
while ((list($key, $val) = each($todo)) && ($count++ <= 2)) {
echo "$key => $val\n";
}