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 Loops While Quizzing

I don't understand this, I need a little help...

This is the question

while (__________($key, $val) =__________ ($learn)) { 
echo "$key => $val\n"; 
}

I don't know what to fill it with

Oh! and on that note I don't want to make another question on this but heres another problem on another quiz,

Link :

(https://teamtreehouse.com/library/php-arrays-and-control-structures/php-loops/quiz-for-loops)

Problem :

The next loop we'll look at is a "for loop". for loops are the most complex loops in PHP because they use 
 ________expressions instead of just one.

Any help appreciated :D

2 Answers

Algirdas Lalys
Algirdas Lalys
9,389 Points

Hi channonhall,

The first. Personally I have never used it, but it's good to know that they exist:)

<?php
while ( list($key, $val) = each($learn)) { 
    echo "$key => $val\n"; 
}
?>

And the Second is The next loop we'll look at is a "for loop". for loops are the most complex loops in PHP because they use three expressions instead of just one. Hope it helps:)

Thanks Algirdas! Thanks for helping! I dont know if this worked yet but It looks legit to me :D And now that I realise the second one was so easy I was thinking really hard on that question (A bit too hard :P), Anyways I'm just blabbering thanks!

Algirdas Lalys
Algirdas Lalys
9,389 Points

Yea, when I first encoutered that second question I though "multiple expressions" was the answer:)