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 Basics Daily Exercise Program Conditionals

Wassim Murr
Wassim Murr
13,296 Points

The code is working, however the "Check Work" button is indicating that it is the wrong answer.

When I press the preview my code button, the results are the ones we are looking for. However, checking my work is indicating that my code is wrong.

It seems that the "Check work" function is looking for a specific format in order to judge whether the code I entered is correct or not.

index.php
<?php
$studentOneName = 'Dave';
$studentOneGPA = 3.8;

$studentTwoName = 'Treasure';
$studentTwoGPA = 4.0;

//Place your code below this comment<?php
if ($studentOneGPA == 4) { echo "$studentOneName made the Honor Role"; }
else { echo "$studentOneName has a GPA of $studentOneGPA"; }

echo "<br/>";

if ($studentTwoGPA == 4) { echo "$studentTwoName made the Honor Role"; }
else { echo "$studentTwoName has a GPA of $studentTwoGPA"; }

?>

1 Answer

Jennifer Nordell
seal-mask
STAFF
.a{fill-rule:evenodd;}techdegree
Jennifer Nordell
Treehouse Teacher

Yes, it is looking for a specific thing. And you're not the first one to run into this. I submitted a bug report on Friday. But lack of whitespace will break it. Specifically, the echo must be on its own line. I posted a solution here and if you look at it, you'll notice the logic is the same (other than you have an additional <br />). Hope this helps! :sparkles:

Wassim Murr
Wassim Murr
13,296 Points

Thank you Jennifer! Your solution works!