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 trialSteve Seebart
Courses Plus Student 11,897 PointsCode challenge works in workspaces, but doesn't generates error in the challenge.
I tried this to get through the challenge, but got the "When the $_SESSION['word'] array is not set, you should redirect to the play.php page." error. When I plugged it into workspaces with some testing code, it seemed to work fine. Am I missing something?
$i = 1; for ($i; $i <= 5; $i++) { if (!isset($_SESSION['word'][$i])) { header ('location: play.php?p=' . $i); break; } }
1 Answer
Steven Parker
231,269 PointsI don't think the challenge likes to see whitespace between a function name and parentheses.
Also, you might want to "exit" instead of "break".
Steve Seebart
Courses Plus Student 11,897 PointsSteve Seebart
Courses Plus Student 11,897 PointsHmmm. Challenge editor messin' with my aesthetic!
Good call on "exit," thanks!