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

Incorrect output?

I'm getting an "incorrect output" message, but I don't know how the output is supposed to look so I'm not sure how to go about changing my code to reflect the desired output. Any help would be greatly appreciated.

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

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

//Place your code below this comment
if ($studentOneGPA == 4.0) {
  echo ' ' . $studentOneName . ' has made the Honor Roll';
} else {
  echo ''.$studentOneName.' has a GPA of '.$studentOneGPA.'';
}
if ($studentTwoGPA == 4.0) {
  echo ' ' . $studentTwoName . ' has made the Honor Roll';
} else {
  echo ''.$studentTwoName.' has a GPA of '.$studentTwoGPA.'';
}
?>

1 Answer

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

Hi there, Nate Nins ! It looks like you're doing pretty terrific. I feel like maybe you misread part of the instructions.

It should say something like "Nate made the Honor Roll" when they have a GPA of 4.0. Instead, yours has an extra word. It contains the word "has". So yours would say "Nate has made the Honor Roll" as opposed to "Nate made the Honor Roll".

Removing the "has" from the two lines where the GPA is 4.0 causes this to pass :tada:

Hope this helps! :sparkles:

Of course. Thank you!!!