Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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!!!